UI: Fix property widgets not being disabled
This commit is contained in:
parent
8f4f38c30e
commit
3544a2da48
@ -291,6 +291,11 @@ void OBSPropertiesView::AddPath(obs_property_t *prop, QFormLayout *layout,
|
|||||||
QLineEdit *edit = new QLineEdit();
|
QLineEdit *edit = new QLineEdit();
|
||||||
QPushButton *button = new QPushButton(QTStr("Browse"));
|
QPushButton *button = new QPushButton(QTStr("Browse"));
|
||||||
|
|
||||||
|
if (!obs_property_enabled(prop)) {
|
||||||
|
edit->setEnabled(false);
|
||||||
|
button->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
edit->setText(QT_UTF8(val));
|
edit->setText(QT_UTF8(val));
|
||||||
edit->setReadOnly(true);
|
edit->setReadOnly(true);
|
||||||
edit->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
edit->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
||||||
@ -316,6 +321,9 @@ void OBSPropertiesView::AddInt(obs_property_t *prop, QFormLayout *layout,
|
|||||||
int val = (int)obs_data_get_int(settings, name);
|
int val = (int)obs_data_get_int(settings, name);
|
||||||
QSpinBox *spin = new QSpinBox();
|
QSpinBox *spin = new QSpinBox();
|
||||||
|
|
||||||
|
if (!obs_property_enabled(prop))
|
||||||
|
spin->setEnabled(false);
|
||||||
|
|
||||||
int minVal = obs_property_int_min(prop);
|
int minVal = obs_property_int_min(prop);
|
||||||
int maxVal = obs_property_int_max(prop);
|
int maxVal = obs_property_int_max(prop);
|
||||||
int stepVal = obs_property_int_step(prop);
|
int stepVal = obs_property_int_step(prop);
|
||||||
@ -362,6 +370,9 @@ void OBSPropertiesView::AddFloat(obs_property_t *prop, QFormLayout *layout,
|
|||||||
double val = obs_data_get_double(settings, name);
|
double val = obs_data_get_double(settings, name);
|
||||||
QDoubleSpinBox *spin = new QDoubleSpinBox();
|
QDoubleSpinBox *spin = new QDoubleSpinBox();
|
||||||
|
|
||||||
|
if (!obs_property_enabled(prop))
|
||||||
|
spin->setEnabled(false);
|
||||||
|
|
||||||
double minVal = obs_property_float_min(prop);
|
double minVal = obs_property_float_min(prop);
|
||||||
double maxVal = obs_property_float_max(prop);
|
double maxVal = obs_property_float_max(prop);
|
||||||
double stepVal = obs_property_float_step(prop);
|
double stepVal = obs_property_float_step(prop);
|
||||||
@ -554,6 +565,9 @@ void OBSPropertiesView::AddEditableList(obs_property_t *prop,
|
|||||||
QListWidget *list = new QListWidget();
|
QListWidget *list = new QListWidget();
|
||||||
size_t count = obs_data_array_count(array);
|
size_t count = obs_data_array_count(array);
|
||||||
|
|
||||||
|
if (!obs_property_enabled(prop))
|
||||||
|
list->setEnabled(false);
|
||||||
|
|
||||||
list->setSortingEnabled(false);
|
list->setSortingEnabled(false);
|
||||||
list->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
list->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
list->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
list->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
||||||
@ -609,6 +623,11 @@ void OBSPropertiesView::AddColor(obs_property_t *prop, QFormLayout *layout,
|
|||||||
long long val = obs_data_get_int(settings, name);
|
long long val = obs_data_get_int(settings, name);
|
||||||
QColor color = color_from_int(val);
|
QColor color = color_from_int(val);
|
||||||
|
|
||||||
|
if (!obs_property_enabled(prop)) {
|
||||||
|
button->setEnabled(false);
|
||||||
|
colorLabel->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
button->setText(QTStr("Basic.PropertiesWindow.SelectColor"));
|
button->setText(QTStr("Basic.PropertiesWindow.SelectColor"));
|
||||||
button->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
button->setToolTip(QT_UTF8(obs_property_long_description(prop)));
|
||||||
|
|
||||||
@ -671,6 +690,11 @@ void OBSPropertiesView::AddFont(obs_property_t *prop, QFormLayout *layout,
|
|||||||
QLabel *fontLabel = new QLabel;
|
QLabel *fontLabel = new QLabel;
|
||||||
QFont font;
|
QFont font;
|
||||||
|
|
||||||
|
if (!obs_property_enabled(prop)) {
|
||||||
|
button->setEnabled(false);
|
||||||
|
fontLabel->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
font = fontLabel->font();
|
font = fontLabel->font();
|
||||||
MakeQFont(font_obj, font, true);
|
MakeQFont(font_obj, font, true);
|
||||||
|
|
||||||
@ -1356,6 +1380,9 @@ void OBSPropertiesView::AddProperty(obs_property_t *property,
|
|||||||
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (label && !obs_property_enabled(property))
|
||||||
|
label->setEnabled(false);
|
||||||
|
|
||||||
if (!widget)
|
if (!widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user