From 1ba6faeea01cd5eeba854d559344eb01a5c64574 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 17 Jan 2022 12:08:08 +0100 Subject: [PATCH] Disable showing/hiding magnifier by pressing Alt modifier The Alt modifier doesn't work well with mouse wheel as it causes the horizontal wheel to be triggered. Disable the Alt modifier as a shortcut for activating the Magnifier. When Magnifier is shown by activating the toolbar action, the magnification works by simple mouse wheel without any modifier. Fixes: QTCREATORBUG-25612 Change-Id: Idb7c40dbf92ed135a796c9623cc46b6b1e80e9e6 Reviewed-by: Reviewed-by: Alessandro Portale --- src/plugins/scxmleditor/common/graphicsview.cpp | 2 -- src/plugins/scxmleditor/common/magnifier.cpp | 4 ---- src/plugins/scxmleditor/plugin_interface/actionhandler.cpp | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugins/scxmleditor/common/graphicsview.cpp b/src/plugins/scxmleditor/common/graphicsview.cpp index d1ac25cd60f..24155e7d108 100644 --- a/src/plugins/scxmleditor/common/graphicsview.cpp +++ b/src/plugins/scxmleditor/common/graphicsview.cpp @@ -168,14 +168,12 @@ QImage GraphicsView::grabView() void GraphicsView::keyReleaseEvent(QKeyEvent *event) { emit panningChanged(event->modifiers() == Qt::ShiftModifier); - emit magnifierChanged(event->modifiers() == Qt::AltModifier); QGraphicsView::keyReleaseEvent(event); } void GraphicsView::keyPressEvent(QKeyEvent *event) { emit panningChanged(event->modifiers() == Qt::ShiftModifier); - emit magnifierChanged(event->modifiers() == Qt::AltModifier); QGraphicsView::keyPressEvent(event); } diff --git a/src/plugins/scxmleditor/common/magnifier.cpp b/src/plugins/scxmleditor/common/magnifier.cpp index c975c7a7248..2ef80f3dbda 100644 --- a/src/plugins/scxmleditor/common/magnifier.cpp +++ b/src/plugins/scxmleditor/common/magnifier.cpp @@ -104,10 +104,6 @@ void Magnifier::wheelEvent(QWheelEvent *e) bool Magnifier::eventFilter(QObject * /*obj*/, QEvent *event) { - if (event->type() == QEvent::KeyRelease - && static_cast(event)->key() == Qt::Key_Alt) { - setVisible(false); - } if (event->type() == QEvent::ApplicationStateChange && QGuiApplication::applicationState() != Qt::ApplicationActive) { setVisible(false); diff --git a/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp b/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp index 80d728a4339..8a634a8c4ca 100644 --- a/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp +++ b/src/plugins/scxmleditor/plugin_interface/actionhandler.cpp @@ -47,7 +47,7 @@ ActionHandler::ActionHandler(QObject *parent) {Utils::Icons::FITTOVIEW_TOOLBAR, tr("Fit to View"), tr("Fit to View (F11)"), "F11", false}, {Utils::Icons::PAN_TOOLBAR, tr("Panning"), tr("Panning (Shift)"), "Shift", true}, - {Utils::Icons::ZOOM_TOOLBAR, tr("Magnifier"), tr("Magnifier Tool (Alt)"), "Alt", true}, + {Utils::Icons::ZOOM_TOOLBAR, tr("Magnifier"), tr("Magnifier Tool"), "", true}, {Utils::Icon(":/scxmleditor/images/navigator.png"), tr("Navigator"), tr("Navigator (Ctrl+E)"), "Ctrl+E", true}, {Utils::Icons::COPY_TOOLBAR, tr("Copy"), tr("Copy (Ctrl + C)"), "Ctrl+C", false},