NOISSUE select modpack field content on focus in new instance dialog
This commit is contained in:
parent
1f0e76a3c1
commit
5ccfbba435
@ -200,6 +200,8 @@ SET(MULTIMC_SOURCES
|
||||
# GUI - widgets
|
||||
widgets/Common.cpp
|
||||
widgets/Common.h
|
||||
widgets/FocusLineEdit.cpp
|
||||
widgets/FocusLineEdit.h
|
||||
widgets/IconLabel.cpp
|
||||
widgets/IconLabel.h
|
||||
widgets/LabeledToolButton.cpp
|
||||
|
@ -9,7 +9,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>277</width>
|
||||
<width>281</width>
|
||||
<height>404</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -118,7 +118,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLineEdit" name="modpackEdit">
|
||||
<widget class="FocusLineEdit" name="modpackEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -192,6 +192,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>FocusLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>widgets/FocusLineEdit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>instNameTextBox</tabstop>
|
||||
<tabstop>groupBox</tabstop>
|
||||
|
25
application/widgets/FocusLineEdit.cpp
Normal file
25
application/widgets/FocusLineEdit.cpp
Normal file
@ -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();
|
||||
}
|
17
application/widgets/FocusLineEdit.h
Normal file
17
application/widgets/FocusLineEdit.h
Normal file
@ -0,0 +1,17 @@
|
||||
#include <QLineEdit>
|
||||
|
||||
class FocusLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FocusLineEdit(QWidget *parent);
|
||||
virtual ~FocusLineEdit()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *e);
|
||||
void mousePressEvent(QMouseEvent *me);
|
||||
|
||||
bool _selectOnMousePress;
|
||||
};
|
Loading…
Reference in New Issue
Block a user