*/
void ModuleBase_ParamSpinBox::setText(const QString& value)
{
+ myTextValue = value;
lineEdit()->setText(value);
}
bool ModuleBase_ParamSpinBox::hasVariable(const QString& theText) const
{
- QString aDigitPattern = QString("[-+]?[0-9]*[%1]?[0-9]+([eE][-+]?[0-9]+)?");
-
+ //const QString aDigitPattern = QString("[-+]?[0-9]*[%1]?[0-9]*([eE][-+]?[0-9]+)?");
+
+ //bool aHasDigit = false;
+ //{
+ // QRegExp varNameMask(aDigitPattern.arg("."));
+ // aHasDigit = varNameMask.exactMatch(theText);
+ //}
+ //if (!aHasDigit)
+ //{
+ // QRegExp varNameMask(aDigitPattern.arg(","));
+ // aHasDigit = varNameMask.exactMatch(theText);
+ //}
bool aHasDigit = false;
- {
- QRegExp varNameMask(aDigitPattern.arg("."));
- aHasDigit = varNameMask.exactMatch(theText);
- }
- if (!aHasDigit)
- {
- QRegExp varNameMask(aDigitPattern.arg(","));
- aHasDigit = varNameMask.exactMatch(theText);
- }
-
+ theText.toDouble(&aHasDigit);
return !aHasDigit;
}
void setSpinText(ModuleBase_ParamSpinBox* theSpin, const QString& theText)
{
- if (theSpin->text() != theText) {
- // In order to avoid extra text setting because it will
- // reset cursor position in control
- bool isBlocked = theSpin->blockSignals(true);
- theSpin->setText(theText);
- theSpin->blockSignals(isBlocked);
- }
+ if (theSpin->text() == theText)
+ return;
+ // In order to avoid extra text setting because it will
+ // reset cursor position in control
+ bool isBlocked = theSpin->blockSignals(true);
+ theSpin->setText(theText);
+ theSpin->blockSignals(isBlocked);
}
void setSpinValue(QDoubleSpinBox* theSpin, double theValue)
{
+ if (theSpin->value() == theValue)
+ return;
bool isBlocked = theSpin->blockSignals(true);
theSpin->setValue(theValue);
theSpin->blockSignals(isBlocked);
void setSpinValue(ModuleBase_ParamSpinBox* theSpin, double theValue)
{
+ if (theSpin->value() == theValue)
+ return;
bool isBlocked = theSpin->blockSignals(true);
theSpin->setValue(theValue);
theSpin->blockSignals(isBlocked);