From 38e3a2af0d8d987b89e71ca4125e78bb3c8538aa Mon Sep 17 00:00:00 2001
From: Fatih Uzunoglu <fuzun54@outlook.com>
Date: Tue, 25 Mar 2025 18:56:19 +0200
Subject: [PATCH] qt: re-enable using top-level window for tool tip on Wayland
 with Qt 6.9.1

The behavior seems fine to me with Qt 6.9.0-beta3 and KWin Wayland 6.3.1.

Unfortunately there is a regression that the window x can no longer be
negative (QTBUG-135158) with regard to the interface window, but that
is not relevant to QTBUG-131899. This regression is expected to be fixed
by the latest Qt 6.9.1.
---
 modules/gui/qt/maininterface/mainctx.hpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/maininterface/mainctx.hpp b/modules/gui/qt/maininterface/mainctx.hpp
index ba82c43bccef..43c7d1fcf905 100644
--- a/modules/gui/qt/maininterface/mainctx.hpp
+++ b/modules/gui/qt/maininterface/mainctx.hpp
@@ -260,14 +260,17 @@ public:
 
     Q_INVOKABLE static inline bool useTopLevelWindowForToolTip() {
         assert(qGuiApp);
-        if (QT_VERSION < QT_VERSION_CHECK(6, 8, 0))
+        if constexpr (QT_VERSION < QT_VERSION_CHECK(6, 8, 0))
             return false; // Feature is not available
 #ifndef QT_STATIC // We have patched contrib Qt to fix both of the spotted Qt bugs
-        if (QT_VERSION < QT_VERSION_CHECK(6, 8, 2))
+        if constexpr (QT_VERSION < QT_VERSION_CHECK(6, 8, 2))
             return false; // This feature was not tested properly upstream, and often causes crashes (QTBUG-131898, #28919).
 #endif
-        if (qGuiApp->platformName().startsWith(QLatin1String("wayland")))
-            return false; // Wayland is too buggy (tested with KWin 6.2), and there is no sign it'll improve by Qt 6.8.2 (QTBUG-131899).
+        if constexpr (QT_VERSION < QT_VERSION_CHECK(6, 9, 1))
+        {
+            if (qGuiApp->platformName().startsWith(QLatin1String("wayland")))
+                return false; // QTBUG-135158
+        }
         return true;
     }
     
-- 
GitLab