[Expression] Default to current 'constant' value when editing if no expression set yet ; fixes #4298

Move signals connecting before value initialization so it's not needed to call them manually
 Only spin boxes implemented (should be the major usage)
This commit is contained in:
0penBrain
2020-04-07 21:20:23 +02:00
committed by wmayer
parent 1b7edf4020
commit ba4d70e7a4

View File

@@ -55,14 +55,20 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path,
// Setup UI
ui->setupUi(this);
if (expression) {
ui->expression->setText(Base::Tools::fromStdString(expression->toString()));
textChanged(Base::Tools::fromStdString(expression->toString()));
}
// Connect signal(s)
connect(ui->expression, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
connect(ui->discardBtn, SIGNAL(clicked()), this, SLOT(setDiscarded()));
if (expression) {
ui->expression->setText(Base::Tools::fromStdString(expression->toString()));
}
else
{
QAbstractSpinBox *sb = dynamic_cast<QAbstractSpinBox*>(parent);
if (sb) {
ui->expression->setText(sb->text());
}
}
// Set document object on line edit to create auto completer
DocumentObject * docObj = path.getDocumentObject();