Gui: [skip ci] use a widget's text property instead of casting to a specific subtype

This way DlgExpressionInput can be used together with the class InputField
This commit is contained in:
wmayer
2020-05-09 11:25:30 +02:00
parent 685e22d23d
commit 66c3ba206b

View File

@@ -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<QAbstractSpinBox*>(parent);
if (sb) {
ui->expression->setText(sb->text());
else {
QVariant text = parent->property("text");
if (text.canConvert(QMetaType::QString)) {
ui->expression->setText(text.toString());
}
}