Windows QPA: Prevent usage of child windows as transient parent
When using foreign window integrations such as MFC/winmigrate, it is possible that a child window is found which can cause issues with modality. Loop up to top level. Task-number: QTSOLBUG-71 Task-number: QTBUG-57159 Change-Id: Ib36e0f8f4f6b1e22ba1240013871facef2c0c1ab Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
parent
45948967bd
commit
79352528a1
@ -1273,6 +1273,12 @@ void QWindowsWindow::updateTransientParent() const
|
||||
if (const QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(tp))
|
||||
if (!tw->testFlag(WithinDestroy)) // Prevent destruction by parent window (QTBUG-35499, QTBUG-36666)
|
||||
newTransientParent = tw->handle();
|
||||
|
||||
// QTSOLBUG-71: When using the MFC/winmigrate solution, it is possible that a child
|
||||
// window is found, which can cause issues with modality. Loop up to top level.
|
||||
while (newTransientParent && (GetWindowLongPtr(newTransientParent, GWL_STYLE) & WS_CHILD) != 0)
|
||||
newTransientParent = GetParent(newTransientParent);
|
||||
|
||||
if (newTransientParent != oldTransientParent)
|
||||
SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, LONG_PTR(newTransientParent));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user