diff options
Diffstat (limited to 'application/widgets/FocusLineEdit.cpp')
-rw-r--r-- | application/widgets/FocusLineEdit.cpp | 25 |
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(); +} |