aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/guiutils.cpp
diff options
context:
space:
mode:
authorJarek Kobus <[email protected]>2023-12-07 14:29:14 +0100
committerJarek Kobus <[email protected]>2024-01-05 12:09:29 +0000
commit3a9c5a3e7d59a575306603916b386463b71aceec (patch)
tree8f2243da2dc4aaceaf000e0b8d1e372305a37a9d /src/libs/utils/guiutils.cpp
parentb49c40181a61e7ad08baa9265d4461ecefdeab01 (diff)
ManhattanStyle: Remove a hack for QComboBox wheel scrolling
Use Utils::setWheelScrollingWithoutFocusBlocked() explicitly when a QComboBox is placed inside a scroll area. The Utils::setWheelScrollingWithoutFocusBlocked() is more general and may be applied to other widgets, like QSpinBox. This patch brings back the wheel scrolling without a modifier key for combo boxes placed in dialogs. Keep the unconditional scroll wheel behavior when ctrl (meta on mac) modifier is pressed. Change-Id: Ieea0f228cea6b59e276bd3256eb6ea5ecc5b7d14 Reviewed-by: <[email protected]> Reviewed-by: Eike Ziller <[email protected]>
Diffstat (limited to 'src/libs/utils/guiutils.cpp')
-rw-r--r--src/libs/utils/guiutils.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libs/utils/guiutils.cpp b/src/libs/utils/guiutils.cpp
index 35830f1ca41..17cc9053002 100644
--- a/src/libs/utils/guiutils.cpp
+++ b/src/libs/utils/guiutils.cpp
@@ -2,19 +2,27 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "guiutils.h"
+#include "hostosinfo.h"
#include <QEvent>
+#include <QGuiApplication>
#include <QWidget>
namespace Utils {
namespace Internal {
+static bool isWheelModifier()
+{
+ return QGuiApplication::keyboardModifiers()
+ == (HostOsInfo::isMacHost() ? Qt::MetaModifier : Qt::ControlModifier);
+}
+
class WheelEventFilter : public QObject
{
public:
bool eventFilter(QObject *watched, QEvent *event) override {
- if (event->type() == QEvent::Wheel) {
+ if (event->type() == QEvent::Wheel && !isWheelModifier()) {
QWidget *widget = qobject_cast<QWidget *>(watched);
if (widget && widget->focusPolicy() != Qt::WheelFocus && !widget->hasFocus()) {
QObject *parent = widget->parentWidget();