summaryrefslogtreecommitdiffstats
path: root/application/widgets/FocusLineEdit.cpp
blob: 139126c804e010df19d86ffc6bffaca1e4886e63 (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();
}