From 144b314694b71b837d2d1a04d975aef224a76cbe Mon Sep 17 00:00:00 2001 From: Sebastian Streich Date: Tue, 10 Dec 2024 14:28:06 +0100 Subject: [PATCH] Nit: fix showWindow (#10003) * Nit: fix showWindow * format --- src/qmlengineholder.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/qmlengineholder.cpp b/src/qmlengineholder.cpp index 40c016e025..6c6a8408f2 100644 --- a/src/qmlengineholder.cpp +++ b/src/qmlengineholder.cpp @@ -128,10 +128,22 @@ bool QmlEngineHolder::hasWindow() const { void QmlEngineHolder::showWindow() { QWindow* w = window(); Q_ASSERT(w); + if (!w) { + return; + } w->show(); - w->raise(); + w->requestActivate(); +#ifdef MZ_WINDOWS + auto const windowHandle = (HWND)w->winId(); + SetWindowPos(windowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + SetForegroundWindow(windowHandle); + SetWindowPos(windowHandle, HWND_NOTOPMOST, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE); +#else + w->raise(); +#endif } void QmlEngineHolder::hideWindow() {