Dialogs: allow dialogs to open when the parent is a QWindow


Non-native dialogs require a parent window in order to open.
Normally this will be automatically detected by
QQuickAbstractDialog::windowForOpen(), which makes the assumption that
the parent of any dialog object is a QQuickItem.

In cases where a dialog object is created dynamically, and explicitly
given a QQuickWindow as the parent, this assumption would fail, and the
function would return nullptr, causing the dialog to not work.

The fix is simple, just check if the immediate parent object is a window
type, in which case, we use that as the dialogs parent. Otherwise, fall
back to the existing behavior of picking the parent item's render window.

Pick-to: 6.12
Fixes: QTBUG-147240
Change-Id: I71a97d05942ef7edaf174cf78649b1674dfe113a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
commit4d68f6bdccdfe0abe00be8ac1780c31e901211d3
parenta9b4d01e899d101d1a29a036cde580a9eb653bb0
authorOliver Eftevaag <oliver.eftevaag@qt.io>
committerOliver Eftevaag <oliver.eftevaag@qt.io>
commit timeWed, 14 Oct 2026 11:09:37 +0000