From 2aa6116c7134f7417ffd8e13e45ea97bb1673eb1 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 29 Nov 2016 04:17:18 +0100 Subject: [PATCH] ui: Removed font zoom on CTRL + MouseWheel --- src/lib_gui/qt/window/QtMainWindow.cpp | 42 -------------------------- src/lib_gui/qt/window/QtMainWindow.h | 19 ------------ 2 files changed, 61 deletions(-) diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 7c3b1453..3953dd40 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -91,47 +91,6 @@ bool MouseReleaseFilter::eventFilter(QObject* obj, QEvent* event) return QObject::eventFilter(obj, event); } -MouseWheelFilter::MouseWheelFilter(QObject* parent) - : QObject(parent) - , m_isWaiting(false) -{ -} - -bool MouseWheelFilter::eventFilter(QObject* obj, QEvent* event) -{ - bool dispatched = false; - - if (!m_isWaiting && event->type() == QEvent::Wheel && QApplication::keyboardModifiers() == Qt::ControlModifier) - { - QWheelEvent* wheelEvent = dynamic_cast(event); - - if (wheelEvent->delta() > 0.0f) - { - MessageZoom(true).dispatch(); - dispatched = true; - } - else if (wheelEvent->delta() < 0.0f) - { - MessageZoom(false).dispatch(); - dispatched = true; - } - } - - if (dispatched) - { - QTimer::singleShot(250, this, SLOT(stopWaiting())); - m_isWaiting = true; - return true; - } - - return QObject::eventFilter(obj, event); -} - -void MouseWheelFilter::stopWaiting() -{ - m_isWaiting = false; -} - QtMainWindow::QtMainWindow() : m_showDockWidgetTitleBars(true) @@ -146,7 +105,6 @@ QtMainWindow::QtMainWindow() QApplication* app = dynamic_cast(QCoreApplication::instance()); app->installEventFilter(new MouseReleaseFilter(this)); - app->installEventFilter(new MouseWheelFilter(this)); app->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "main.css").c_str()); diff --git a/src/lib_gui/qt/window/QtMainWindow.h b/src/lib_gui/qt/window/QtMainWindow.h index 2be46f94..f16d91b2 100644 --- a/src/lib_gui/qt/window/QtMainWindow.h +++ b/src/lib_gui/qt/window/QtMainWindow.h @@ -48,25 +48,6 @@ private: }; -class MouseWheelFilter - : public QObject -{ - Q_OBJECT - -public: - MouseWheelFilter(QObject* parent); - -protected: - bool eventFilter(QObject* obj, QEvent* event); - -private slots: - void stopWaiting(); - -private: - bool m_isWaiting; -}; - - class QtMainWindow : public QMainWindow {