QWindowContainer: Respect WA_DontCreateNativeAncestors

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 <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit 14481614439a2fcb1f7f3d7820334f5af50be732)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Paul Olav Tvete 2024-08-21 13:25:02 +02:00 committed by Qt Cherry-pick Bot
parent 0aed515878
commit fa254beb64

View File

@ -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;