summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-02-11 21:42:00 +0100
committerGitHub <noreply@github.com>2021-02-11 21:42:00 +0100
commitbf758fbe7c218b6d7c0a53bee2ee6593c4bf914c (patch)
tree55935d3edb8e57cfdbb6702bfbfd8116515eabb1 /Source
parent3ce72d4005c38d1e36b0f62be94b7ca85b868ba6 (diff)
parent43b389410a6479bbeed83c4a29b175b05df8476f (diff)
Merge pull request #9490 from Dentomologist/fix_expression_scroll_wheel_spam
Config: Fix expression window scroll wheel spam
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp9
-rw-r--r--Source/Core/DolphinQt/Config/Mapping/IOWindow.h13
2 files changed, 19 insertions, 3 deletions
diff --git a/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp
index 887063e8aa..dc6f3404ea 100644
--- a/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp
+++ b/Source/Core/DolphinQt/Config/Mapping/IOWindow.cpp
@@ -98,6 +98,11 @@ ControlExpressionSyntaxHighlighter::ControlExpressionSyntaxHighlighter(QTextDocu
{
}
+void QComboBoxWithMouseWheelDisabled::wheelEvent(QWheelEvent* event)
+{
+ // Do nothing
+}
+
void ControlExpressionSyntaxHighlighter::highlightBlock(const QString&)
{
// TODO: This is going to result in improper highlighting with non-ascii characters:
@@ -253,7 +258,7 @@ void IOWindow::CreateMainLayout()
m_expression_text->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
new ControlExpressionSyntaxHighlighter(m_expression_text->document());
- m_operators_combo = new QComboBox();
+ m_operators_combo = new QComboBoxWithMouseWheelDisabled();
m_operators_combo->addItem(tr("Operators"));
m_operators_combo->insertSeparator(1);
if (m_type == Type::Input)
@@ -275,7 +280,7 @@ void IOWindow::CreateMainLayout()
m_operators_combo->addItem(tr(", Comma"));
}
- m_functions_combo = new QComboBox(this);
+ m_functions_combo = new QComboBoxWithMouseWheelDisabled(this);
m_functions_combo->addItem(tr("Functions"));
m_functions_combo->insertSeparator(1);
m_functions_combo->addItem(QStringLiteral("if"));
diff --git a/Source/Core/DolphinQt/Config/Mapping/IOWindow.h b/Source/Core/DolphinQt/Config/Mapping/IOWindow.h
index 87e2e0843a..8969db2a56 100644
--- a/Source/Core/DolphinQt/Config/Mapping/IOWindow.h
+++ b/Source/Core/DolphinQt/Config/Mapping/IOWindow.h
@@ -7,6 +7,7 @@
#include <memory>
#include <string>
+#include <QComboBox>
#include <QDialog>
#include <QString>
#include <QSyntaxHighlighter>
@@ -17,7 +18,6 @@
class ControlReference;
class MappingWidget;
class QAbstractButton;
-class QComboBox;
class QDialogButtonBox;
class QLineEdit;
class QTableWidget;
@@ -45,6 +45,17 @@ protected:
void highlightBlock(const QString& text) final override;
};
+class QComboBoxWithMouseWheelDisabled : public QComboBox
+{
+ Q_OBJECT
+public:
+ explicit QComboBoxWithMouseWheelDisabled(QWidget* parent = nullptr) : QComboBox(parent) {}
+
+protected:
+ // Consumes event while doing nothing
+ void wheelEvent(QWheelEvent* event) override;
+};
+
class IOWindow final : public QDialog
{
Q_OBJECT