From d8fdcea0d17a5a030b134e8ce559b480c1614b5e Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 23 Oct 2024 17:31:53 +0200 Subject: [PATCH] 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 (cherry picked from commit 81f8eee6a1e1cfcf4bf1f2dac863e94e0f872559) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/util/qcompleter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 93cea978d1f..2e78b0ee04e 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -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)