From fa254beb647b3233b5a4670fc8cd56eca847a32f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 21 Aug 2024 13:25:02 +0200 Subject: [PATCH] QWindowContainer: Respect WA_DontCreateNativeAncestors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QWindowContainer forces a native window if it has a scroll area or an MDI area as an ancestor. This breaks if WA_DontCreateNativeAncestors is set, because the window container logic assumes that either there are no native widgets in the parent chain, or all of them are native. To avoid this problem, don't turn the window container native if it has the WA_DontCreateNativeAncestors attribute set. Task-number: QTBUG-128029 Change-Id: Ifca50c9abd7175a0af5b62b196a86a463a11be31 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Tor Arne Vestbø Reviewed-by: David Edmundson (cherry picked from commit 14481614439a2fcb1f7f3d7820334f5af50be732) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/kernel/qwindowcontainer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 1aaf04af438..c29caf76a8b 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -62,6 +62,8 @@ public: if (window->parent() == nullptr) return; Q_Q(QWindowContainer); + if (q->testAttribute(Qt::WA_DontCreateNativeAncestors)) + return; if (q->internalWinId()) { // Allow use native widgets if the window container is already a native widget usesNativeWidgets = true;