Add option to disable variable selection

This commit is contained in:
WarmUpTill 2023-07-26 19:49:37 +02:00 committed by WarmUpTill
parent 7b1c56877e
commit 52811e44f4
2 changed files with 13 additions and 2 deletions

View File

@ -76,6 +76,13 @@ void GenericVaraiableSpinbox::SetValue(const NumberVariable<double> &number)
SetVisibility();
}
void GenericVaraiableSpinbox::DisableVariableSelection()
{
_hideTypeToggle = true;
_toggleType->hide();
ToggleTypeClicked(false);
}
void GenericVaraiableSpinbox::setMinimum(double value)
{
_fixedValueInt->setMinimum(value);
@ -168,7 +175,8 @@ void GenericVaraiableSpinbox::SetVisibilityInt()
if (_numberInt.IsFixedType()) {
_fixedValueInt->show();
_variable->hide();
_toggleType->setVisible(!switcher->variables.empty());
_toggleType->setVisible(!switcher->variables.empty() &&
!_hideTypeToggle);
} else {
_fixedValueInt->hide();
_variable->show();
@ -183,7 +191,8 @@ void GenericVaraiableSpinbox::SetVisibilityDouble()
if (_numberDouble.IsFixedType()) {
_fixedValueDouble->show();
_variable->hide();
_toggleType->setVisible(!switcher->variables.empty());
_toggleType->setVisible(!switcher->variables.empty() &&
!_hideTypeToggle);
} else {
_fixedValueDouble->hide();
_variable->show();

View File

@ -14,6 +14,7 @@ public:
GenericVaraiableSpinbox(QWidget *parent, bool wholeNumber);
void SetValue(const NumberVariable<int> &);
void SetValue(const NumberVariable<double> &);
void DisableVariableSelection();
void setMinimum(double value);
void setMaximum(double value);
@ -54,6 +55,7 @@ private:
QPushButton *_toggleType;
VariableSelection *_variable;
bool _wholeNumber;
bool _hideTypeToggle = false;
};
class VariableSpinBox : public GenericVaraiableSpinbox {