Salome HOME
Issue #145 behavior on edit constraint corrected
[modules/shaper.git] / src / PartSet / PartSet_EditLine.cpp
index 4d8e7e9d8a6c15e753f78451e37fa86875da15ed..a7b2ecccb9b1ebfc5f5cf5cff91604c4c3068d5d 100644 (file)
@@ -7,9 +7,11 @@
 #include <QLineEdit>
 
 PartSet_EditLine::PartSet_EditLine(QWidget* theParent)
-: QObject(theParent)
+    : QObject(theParent)
 {
   myEditor = new QLineEdit(theParent);
+  myEditor->setWindowFlags(Qt::ToolTip);
+  myEditor->setFocusPolicy(Qt::StrongFocus);
 
   connect(myEditor, SIGNAL(returnPressed()), this, SLOT(onStopEditing()));
 }
@@ -19,6 +21,19 @@ void PartSet_EditLine::start(const QPoint& thePoint, double theValue)
   myEditor->move(thePoint);
   myEditor->setText(QString::number(theValue));
   myEditor->show();
+
+  myEditor->selectAll();
+  myEditor->setFocus();
+}
+
+bool PartSet_EditLine::isStarted() const
+{
+  return myEditor->isVisible();
+}
+
+void PartSet_EditLine::stop()
+{
+  myEditor->hide();
 }
 
 double PartSet_EditLine::getValue() const
@@ -28,6 +43,6 @@ double PartSet_EditLine::getValue() const
 
 void PartSet_EditLine::onStopEditing()
 {
-  myEditor->hide();
+  stop();
   emit stopped(getValue());
 }