Highlight label in properties-view when a disabled list item is selected
This commit is contained in:
parent
5b5ef6aaf7
commit
b5f56ff579
@ -172,7 +172,7 @@ static void AddComboItem(QComboBox *combo, obs_property_t prop,
|
|||||||
item->setFlags(Qt::NoItemFlags);
|
item->setFlags(Qt::NoItemFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *OBSPropertiesView::AddList(obs_property_t prop)
|
QWidget *OBSPropertiesView::AddList(obs_property_t prop, bool &warning)
|
||||||
{
|
{
|
||||||
const char *name = obs_property_name(prop);
|
const char *name = obs_property_name(prop);
|
||||||
QComboBox *combo = new QComboBox();
|
QComboBox *combo = new QComboBox();
|
||||||
@ -213,6 +213,10 @@ QWidget *OBSPropertiesView::AddList(obs_property_t prop)
|
|||||||
if (idx != -1)
|
if (idx != -1)
|
||||||
combo->setCurrentIndex(idx);
|
combo->setCurrentIndex(idx);
|
||||||
|
|
||||||
|
QAbstractItemModel *model = combo->model();
|
||||||
|
warning = idx != -1 &&
|
||||||
|
model->flags(model->index(idx, 0)) == Qt::NoItemFlags;
|
||||||
|
|
||||||
WidgetInfo *info = new WidgetInfo(this, prop, combo);
|
WidgetInfo *info = new WidgetInfo(this, prop, combo);
|
||||||
connect(combo, SIGNAL(currentIndexChanged(int)), info,
|
connect(combo, SIGNAL(currentIndexChanged(int)), info,
|
||||||
SLOT(ControlChanged()));
|
SLOT(ControlChanged()));
|
||||||
@ -244,6 +248,7 @@ void OBSPropertiesView::AddProperty(obs_property_t property,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QWidget *widget = nullptr;
|
QWidget *widget = nullptr;
|
||||||
|
bool warning = false;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case OBS_PROPERTY_INVALID:
|
case OBS_PROPERTY_INVALID:
|
||||||
@ -264,7 +269,7 @@ void OBSPropertiesView::AddProperty(obs_property_t property,
|
|||||||
AddPath(property, layout);
|
AddPath(property, layout);
|
||||||
break;
|
break;
|
||||||
case OBS_PROPERTY_LIST:
|
case OBS_PROPERTY_LIST:
|
||||||
widget = AddList(property);
|
widget = AddList(property, warning);
|
||||||
break;
|
break;
|
||||||
case OBS_PROPERTY_COLOR:
|
case OBS_PROPERTY_COLOR:
|
||||||
/* TODO */
|
/* TODO */
|
||||||
@ -285,6 +290,9 @@ void OBSPropertiesView::AddProperty(obs_property_t property,
|
|||||||
type != OBS_PROPERTY_BUTTON)
|
type != OBS_PROPERTY_BUTTON)
|
||||||
label = new QLabel(QT_UTF8(obs_property_description(property)));
|
label = new QLabel(QT_UTF8(obs_property_description(property)));
|
||||||
|
|
||||||
|
if (warning && label) //TODO: select color based on background color
|
||||||
|
label->setStyleSheet("QLabel { color: red; }");
|
||||||
|
|
||||||
if (label && minSize) {
|
if (label && minSize) {
|
||||||
label->setMinimumWidth(minSize);
|
label->setMinimumWidth(minSize);
|
||||||
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
@ -65,7 +65,7 @@ private:
|
|||||||
QWidget *AddPath(obs_property_t prop, QFormLayout *layout);
|
QWidget *AddPath(obs_property_t prop, QFormLayout *layout);
|
||||||
QWidget *AddInt(obs_property_t prop);
|
QWidget *AddInt(obs_property_t prop);
|
||||||
QWidget *AddFloat(obs_property_t prop);
|
QWidget *AddFloat(obs_property_t prop);
|
||||||
QWidget *AddList(obs_property_t prop);
|
QWidget *AddList(obs_property_t prop, bool &warning);
|
||||||
QWidget *AddButton(obs_property_t prop);
|
QWidget *AddButton(obs_property_t prop);
|
||||||
|
|
||||||
void AddProperty(obs_property_t property, QFormLayout *layout);
|
void AddProperty(obs_property_t property, QFormLayout *layout);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user