diff --git a/src/Gui/DlgExpressionInput.cpp b/src/Gui/DlgExpressionInput.cpp index 40e3faa240..ad6f7cb387 100644 --- a/src/Gui/DlgExpressionInput.cpp +++ b/src/Gui/DlgExpressionInput.cpp @@ -62,11 +62,10 @@ DlgExpressionInput::DlgExpressionInput(const App::ObjectIdentifier & _path, if (expression) { ui->expression->setText(Base::Tools::fromStdString(expression->toString())); } - else - { - QAbstractSpinBox *sb = dynamic_cast(parent); - if (sb) { - ui->expression->setText(sb->text()); + else { + QVariant text = parent->property("text"); + if (text.canConvert(QMetaType::QString)) { + ui->expression->setText(text.toString()); } }