- DataPtr aData = theFeature->data();
- AttributeDoublePtr aReal = aData->real(attributeID());
- bool isOk;
- double aValue = myEditor->text().toDouble(&isOk);
- if (isOk && aReal->value() != aValue) {
- //ModuleBase_WidgetPoint2D* that = (ModuleBase_WidgetPoint2D*) this;
- //bool isBlocked = that->blockSignals(true);
- aReal->setValue(aValue);
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
- //that->blockSignals(isBlocked);
+ 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();
+ bool isDouble;
+ double aValue = outText.toDouble(&isDouble);
+ if (isDouble) {
+ outValue = aValue;
+ outText = ""; // return empty string, if it's can be converted to a double