[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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user