Salome HOME
Restore old planes selection definition
[modules/shaper.git] / src / PartSet / PartSet_EditLine.cpp
1 // File:        PartSet_EditLine.h
2 // Created:     02 June 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #include <PartSet_EditLine.h>
6
7 #include <QLineEdit>
8
9 PartSet_EditLine::PartSet_EditLine(QWidget* theParent)
10 : QObject(theParent)
11 {
12   myEditor = new QLineEdit(theParent);
13   myEditor->setWindowFlags(Qt::ToolTip);
14   myEditor->setFocusPolicy(Qt::StrongFocus);
15
16   connect(myEditor, SIGNAL(returnPressed()), this, SLOT(onStopEditing()));
17 }
18
19 void PartSet_EditLine::start(const QPoint& thePoint, double theValue)
20 {
21   myEditor->move(thePoint);
22   myEditor->setText(QString::number(theValue));
23   myEditor->show();
24
25   myEditor->selectAll();
26   myEditor->setFocus();
27 }
28
29 bool PartSet_EditLine::isStarted() const
30 {
31   return myEditor->isVisible();
32 }
33
34 void PartSet_EditLine::stop()
35 {
36   myEditor->hide();
37 }
38
39 double PartSet_EditLine::getValue() const
40 {
41   return myEditor->text().toDouble();
42 }
43
44 void PartSet_EditLine::onStopEditing()
45 {
46   stop();
47   emit stopped(getValue());
48 }