mirror of
https://github.com/huderlem/porymap.git
synced 2026-07-02 00:02:04 -05:00
Stop QTextEdit from stealing scroll focus
This commit is contained in:
parent
e8ac633700
commit
d33f0fc6f0
|
|
@ -1374,7 +1374,7 @@
|
|||
<widget class="NoScrollComboBox" name="comboBox_WarpBehaviors"/>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QTextEdit" name="textEdit_WarpBehaviors">
|
||||
<widget class="NoScrollTextEdit" name="textEdit_WarpBehaviors">
|
||||
<property name="toolTip">
|
||||
<string>Metatile Behaviors on this list won't trigger warnings for Warp Events</string>
|
||||
</property>
|
||||
|
|
@ -1744,6 +1744,11 @@
|
|||
<extends>QSpinBox</extends>
|
||||
<header>noscrollspinbox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>NoScrollTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>noscrolltextedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>UIntSpinBox</class>
|
||||
<extends>QAbstractSpinBox</extends>
|
||||
|
|
|
|||
25
include/ui/noscrolltextedit.h
Normal file
25
include/ui/noscrolltextedit.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef NOSCROLLTEXTEDIT_H
|
||||
#define NOSCROLLTEXTEDIT_H
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QWheelEvent>
|
||||
|
||||
class NoScrollTextEdit : public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NoScrollTextEdit(const QString &text, QWidget *parent = nullptr) : QTextEdit(text, parent) {
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
};
|
||||
explicit NoScrollTextEdit(QWidget *parent = nullptr) : NoScrollTextEdit(QString(), parent) {};
|
||||
|
||||
virtual void wheelEvent(QWheelEvent *event) override {
|
||||
if (hasFocus()) {
|
||||
QTextEdit::wheelEvent(event);
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif // NOSCROLLTEXTEDIT_H
|
||||
|
|
@ -223,6 +223,7 @@ HEADERS += include/core/advancemapparser.h \
|
|||
include/ui/newmapgroupdialog.h \
|
||||
include/ui/noscrollcombobox.h \
|
||||
include/ui/noscrollspinbox.h \
|
||||
include/ui/noscrolltextedit.h \
|
||||
include/ui/montabwidget.h \
|
||||
include/ui/encountertablemodel.h \
|
||||
include/ui/encountertabledelegates.h \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user