Skip to content

Commit 9568abd

Browse files
qtwinmigrate: Fix geometry offset
Set the property "_q_embedded_native_parent_handle" on the widget before calling winId() so that it takes effect during native window creation. The bug was unveiled by qtbase/3035400f36731c400adb9204b94e9afe346a71b7. Task-number: QTSOLBUG-196 Change-Id: I5dac836b2845de9833da46bfb72d07aafdf4896a Reviewed-by: Andy Shaw <[email protected]>
1 parent ee17851 commit 9568abd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

qtwinmigrate/src/qwinwidget.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ void QWinWidget::init()
123123
Q_ASSERT(hParent);
124124

125125
if (hParent) {
126+
#if QT_VERSION >= 0x050000
127+
setProperty("_q_embedded_native_parent_handle", WId(hParent));
128+
#endif
126129
// make the widget window style be WS_CHILD so SetParent will work
127130
QT_WA({
128131
SetWindowLong((HWND)winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
@@ -131,7 +134,6 @@ void QWinWidget::init()
131134
})
132135
#if QT_VERSION >= 0x050000
133136
QWindow *window = windowHandle();
134-
window->setProperty("_q_embedded_native_parent_handle", (WId)hParent);
135137
HWND h = static_cast<HWND>(QGuiApplication::platformNativeInterface()->
136138
nativeResourceForWindow("handle", window));
137139
SetParent(h, hParent);

0 commit comments

Comments
 (0)