summaryrefslogtreecommitdiffstats
path: root/application/widgets/FocusLineEdit.cpp
blob: b272100c08b0df7ea7ce09c58a67ab3628a69544 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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();
}