QCompleter: Set transient parent on popup

In order to properly show a popup the Wayland QPA needs a parent window.

Currently it has to guess the parent, which might not work in all
circumstances. To address that explicitly set the widget as transient
parent of the popup.

Fixes: QTBUG-130474
Pick-to: 6.8
Change-Id: I99ea14a1a9ec25ee8a929cf61a6744957a850374
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit 81f8eee6a1e1cfcf4bf1f2dac863e94e0f872559)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Nicolas Fella 2024-10-23 17:31:53 +02:00 committed by Qt Cherry-pick Bot
parent 9db5beae71
commit d8fdcea0d1

View File

@ -923,8 +923,13 @@ void QCompleterPrivate::showPopup(const QRect& rect)
popup->setGeometry(pos.x(), pos.y(), w, h);
if (!popup->isVisible())
if (!popup->isVisible()) {
// Make sure popup has a transient parent set, Wayland needs it. QTBUG-130474
popup->winId(); // force creation of windowHandle
popup->windowHandle()->setTransientParent(widget->window()->windowHandle());
popup->show();
}
}
#if QT_CONFIG(filesystemmodel)