summaryrefslogtreecommitdiffstats
path: root/application/widgets/FocusLineEdit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'application/widgets/FocusLineEdit.cpp')
-rw-r--r--application/widgets/FocusLineEdit.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/application/widgets/FocusLineEdit.cpp b/application/widgets/FocusLineEdit.cpp
new file mode 100644
index 00000000..139126c8
--- /dev/null
+++ b/application/widgets/FocusLineEdit.cpp
@@ -0,0 +1,25 @@
+#include "FocusLineEdit.h"
+#include <QDebug>
+
+FocusLineEdit::FocusLineEdit(QWidget *parent) : QLineEdit(parent)
+{
+ _selectOnMousePress = false;
+}
+
+void FocusLineEdit::focusInEvent(QFocusEvent *e)
+{
+ QLineEdit::focusInEvent(e);
+ selectAll();
+ _selectOnMousePress = true;
+}
+
+void FocusLineEdit::mousePressEvent(QMouseEvent *me)
+{
+ QLineEdit::mousePressEvent(me);
+ if (_selectOnMousePress)
+ {
+ selectAll();
+ _selectOnMousePress = false;
+ }
+ qDebug() << selectedText();
+}