- QMenu* aPopup = new QMenu();
-
- QLineEdit* aEditor = new QLineEdit(QString::number(outValue), aPopup);
- QWidgetAction* aLineEditAction = new QWidgetAction(aPopup);
- aLineEditAction->setDefaultWidget(aEditor);
- aPopup->addAction(aLineEditAction);
-
- aEditor->setFocus();
- aEditor->selectAll();
- QString anExpression("([0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)|([_a-zA-Z][a-zA-Z0-9_]*)");
- aEditor->setValidator(new QRegExpValidator(QRegExp(anExpression), aEditor));
- QObject::connect(aEditor, SIGNAL(returnPressed()), aLineEditAction, SIGNAL(triggered()));
- QObject::connect(aLineEditAction, SIGNAL(triggered()), aPopup, SLOT(hide()));
-
- QAction* aResult = aPopup->exec(QCursor::pos());
- outText = aEditor->text();
+ QDialog aDlg(QApplication::desktop(), Qt::FramelessWindowHint);
+ QHBoxLayout* aLay = new QHBoxLayout(&aDlg);
+ aLay->setContentsMargins(2, 2, 2, 2);
+
+ ModuleBase_ParamSpinBox* anEditor = new ModuleBase_ParamSpinBox(&aDlg);
+ anEditor->enableKeyPressEvent(true);
+
+ anEditor->setMinimum(0);
+ anEditor->setMaximum(DBL_MAX);
+ if (outText.isEmpty())
+ anEditor->setValue(outValue);
+ else
+ anEditor->setText(outText);
+
+ aLay->addWidget(anEditor);
+
+ anEditor->setFocus();
+ anEditor->selectAll();
+ QObject::connect(anEditor, SIGNAL(editingFinished()), &aDlg, SLOT(accept()));
+
+ aDlg.move(QCursor::pos());
+ aDlg.exec();
+ outText = anEditor->text();