PrismLauncher/launcher/ui/widgets/FocusLineEdit.cpp
Sefa Eyeoglu 1d468ac35a
chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2023-08-02 18:35:35 +02:00

25 lines
505 B
C++

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