diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/gui/kernel/qwindow.cpp | 22 | ||||
| -rw-r--r-- | src/gui/kernel/qwindow_p.h | 2 | ||||
| -rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 3 | ||||
| -rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 2 | ||||
| -rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 4 |
5 files changed, 4 insertions, 29 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index b40fd7e8e84..46a787e7064 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -521,9 +521,7 @@ void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate) } } -static constexpr auto kForeignWindowId = "_q_foreignWinId"; - -void QWindowPrivate::create(bool recursive) +void QWindowPrivate::create(bool recursive, WId nativeHandle) { Q_Q(QWindow); if (platformWindow) @@ -551,8 +549,6 @@ void QWindowPrivate::create(bool recursive) setTopLevelScreen(screen, false); } - const WId nativeHandle = q->property(kForeignWindowId).value<WId>(); - QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration(); platformWindow = nativeHandle ? platformIntegration->createForeignWindow(q, nativeHandle) : platformIntegration->createPlatformWindow(q); @@ -2063,16 +2059,6 @@ void QWindowPrivate::destroy() QObject *object = childrenWindows.at(i); if (object->isWindowType()) { QWindow *w = static_cast<QWindow*>(object); - auto *childPlatformWindow = w->handle(); - if (!childPlatformWindow) - continue; - - // Decouple the foreign window from this window, - // so that destroying our native handle doesn't - // bring down the foreign window as well. - if (childPlatformWindow->isForeignWindow()) - childPlatformWindow->setParent(nullptr); - qt_window_private(w)->destroy(); } } @@ -3000,11 +2986,7 @@ QWindow *QWindow::fromWinId(WId id) } QWindow *window = new QWindow; - - // Persist the winId in a private property so that we - // can recreate the window after being destroyed. - window->setProperty(kForeignWindowId, id); - window->create(); + qt_window_private(window)->create(false, id); if (!window->handle()) { delete window; diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index a9716847a1e..1bcbda6b8fd 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -66,7 +66,7 @@ public: void updateSiblingPosition(SiblingPosition); bool windowRecreationRequired(QScreen *newScreen) const; - void create(bool recursive); + void create(bool recursive, WId nativeHandle = 0); void destroy(); void setTopLevelScreen(QScreen *newScreen, bool recreate); void connectToScreen(QScreen *topLevelScreen); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 6b1f6032252..3631d6be70b 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -55,8 +55,7 @@ QIOSWindow::QIOSWindow(QWindow *window, WId nativeHandle) connect(qGuiApp, &QGuiApplication::applicationStateChanged, this, &QIOSWindow::applicationStateChanged); - if (QPlatformWindow::parent()) - setParent(QPlatformWindow::parent()); + setParent(QPlatformWindow::parent()); if (!isForeignWindow()) { // Resolve default window geometry in case it was not set before creating the diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index c54da57ffe8..220c36cc192 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1357,8 +1357,6 @@ QWindowsForeignWindow::QWindowsForeignWindow(QWindow *window, HWND hwnd) , m_hwnd(hwnd) , m_topLevelStyle(0) { - if (QPlatformWindow::parent()) - setParent(QPlatformWindow::parent()); } void QWindowsForeignWindow::setParent(const QPlatformWindow *newParentWindow) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index d3e4fa95482..09d4cd9833a 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -522,10 +522,6 @@ QXcbForeignWindow::QXcbForeignWindow(QWindow *window, WId nativeHandle) QRect nativeGeometry(geometry->x, geometry->y, geometry->width, geometry->height); QPlatformWindow::setGeometry(nativeGeometry); } - - // And reparent, if we have a parent already - if (QPlatformWindow::parent()) - setParent(QPlatformWindow::parent()); } QXcbForeignWindow::~QXcbForeignWindow() |
