PrismLauncher/launcher/ui/widgets/FocusLineEdit.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
509 B
C++
Raw Normal View History

#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();
}