#include <iostream>
#endif
-#define APPLY_BY_ENTER_OR_TAB
-
ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
const Config_WidgetAPI* theData,
const std::string& theParentId)
if (!aLabelIcon.isEmpty())
myLabel->setPixmap(QPixmap(aLabelIcon));
+ bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true);
+
mySpinBox = new ModuleBase_ParamSpinBox(this);
+ mySpinBox->setAcceptVariables(aAcceptVariables);
QString anObjName = QString::fromStdString(attributeID());
mySpinBox->setObjectName(anObjName);
myLabel->setToolTip(aTTip);
aControlLay->addRow(myLabel, mySpinBox);
-#ifdef APPLY_BY_ENTER_OR_TAB
- // Apply widget value change by enter/tab event.
- //connect(mySpinBox, SIGNAL(editingFinished()), this, SIGNAL(valuesChanged()));
- connect(mySpinBox, SIGNAL(valueStored()), this, SIGNAL(valuesChanged()));
connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
- connect(mySpinBox, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
-
-#else
- connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesChanged()));
-#endif
}
ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
bool isOk;
double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk);
// reset the value just if there is a default value definition in the XML definition
- // if the double value can not be found by the default value, do nothing
+ // if the value can not be found by the default value, do nothing
if (isOk) {
ModuleBase_Tools::setSpinValue(mySpinBox, aDefValue);
storeValue();
return true;
}
+void ModuleBase_WidgetDoubleValue::selectContent()
+{
+ mySpinBox->selectAll();
+}
+
QList<QWidget*> ModuleBase_WidgetDoubleValue::getControls() const
{
QList<QWidget*> aList;
bool ModuleBase_WidgetDoubleValue::processEnter()
{
- bool isModified = mySpinBox->isModified();
+ bool isModified = getValueState() == ModifiedInPP;
if (isModified) {
emit valuesChanged();
- mySpinBox->clearModified();
mySpinBox->selectAll();
}
return isModified;