[kdevelop/kdevelop] kdevplatform/sublime: Fix doubled view closing on MMB on view tabbar

Martin Bednar <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit b11a89f383307d8858d9b78b0fa2275735b18ad4 by Martin Bednar, on behalf of Friedrich W. H. Kossebau.
Committed on 22/07/2026 at 23:03.
Pushed by bednar into branch 'master'.

Fix doubled view closing on MMB on view tabbar

For Qt 6.11 rely on native implementation.
For older Qt versions align behaviour to emit the signal on button release.

BUG: 522321
FIXED-IN: 6.6.260800

M  +6    -2    kdevplatform/sublime/container.cpp

https://invent.kde.org/kdevelop/kdevelop/-/commit/b11a89f383307d8858d9b78b0fa2275735b18ad4

diff --git a/kdevplatform/sublime/container.cpp b/kdevplatform/sublime/container.cpp
index a8607d5f3f..0b4c2da689 100644
--- a/kdevplatform/sublime/container.cpp
+++ b/kdevplatform/sublime/container.cpp
@@ -129,7 +129,10 @@ public:
 
         return QTabBar::event(ev);
     }
-    void mousePressEvent(QMouseEvent* event) override {
+
+// Qt >= 6.11 has native implementation for MMB close
+#if QT_VERSION < QT_VERSION_CHECK(6, 11, 0)
+    void mouseReleaseEvent(QMouseEvent* event) override {
         if (event->button() == Qt::MiddleButton) {
             // just close on midbutton, drag can still be done with left mouse button
 
@@ -139,8 +142,9 @@ public:
             }
             return;
         }
-        QTabBar::mousePressEvent(event);
+        QTabBar::mouseReleaseEvent(event);
     }
+#endif
 
     void mouseDoubleClickEvent(QMouseEvent* event) override
     {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.