From 5edbcc1970bc8858ad09a41f4c3ac1700e489c8b Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 25 Jul 2024 08:42:30 +0200 Subject: [PATCH] Fixed issue #654 - Wheel event on DockAreaTabBar --- src/DockAreaTabBar.cpp | 9 +++++++++ src/DockAreaWidget.cpp | 1 - src/DockWidgetTab.cpp | 7 +++++++ src/DockWidgetTab.h | 6 ++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index 81307d0..cf1cb09 100644 --- a/src/DockAreaTabBar.cpp +++ b/src/DockAreaTabBar.cpp @@ -473,6 +473,15 @@ bool CDockAreaTabBar::eventFilter(QObject *watched, QEvent *event) updateGeometry(); break; + // Manage wheel event + case QEvent::Wheel: + // Ignore wheel events if tab is currently dragged + if (Tab->dragState() == DraggingInactive) + { + wheelEvent((QWheelEvent* )event); + } + break; + default: break; } diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index aa6d16d..b3828d3 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -34,7 +34,6 @@ #include #include -#include #include #include #include diff --git a/src/DockWidgetTab.cpp b/src/DockWidgetTab.cpp index 962de17..654c000 100644 --- a/src/DockWidgetTab.cpp +++ b/src/DockWidgetTab.cpp @@ -789,6 +789,13 @@ bool CDockWidgetTab::event(QEvent *e) } +//============================================================================ +eDragState CDockWidgetTab::dragState() const +{ + return d->DragState; +} + + //============================================================================ void CDockWidgetTab::onDockWidgetFeaturesChanged() { diff --git a/src/DockWidgetTab.h b/src/DockWidgetTab.h index 0b5ba71..973a1ad 100644 --- a/src/DockWidgetTab.h +++ b/src/DockWidgetTab.h @@ -178,6 +178,12 @@ public: */ void setIconSize(const QSize& Size); + /** + * Returns the current drag state of this tab. + * Use this function to determine if the tab is currently being dragged + */ + eDragState dragState() const; + public Q_SLOTS: virtual void setVisible(bool visible) override;