Windows: Force toplevel flag in setParent() in both cases.
When re-applying window flags in setParent, force top level on or off according to state. Task-number: QTBUG-28872 Change-Id: If931fcb38394f472a6cdf260aa935c1d03779611 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
71a7ad80c0
commit
cd7ba89a07
@ -267,7 +267,7 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, qreal level)
|
|||||||
struct WindowCreationData
|
struct WindowCreationData
|
||||||
{
|
{
|
||||||
typedef QWindowsWindow::WindowData WindowData;
|
typedef QWindowsWindow::WindowData WindowData;
|
||||||
enum Flags { ForceChild = 0x1 };
|
enum Flags { ForceChild = 0x1, ForceTopLevel = 0x2 };
|
||||||
|
|
||||||
WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0),
|
WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0),
|
||||||
topLevel(false), popup(false), dialog(false), desktop(false),
|
topLevel(false), popup(false), dialog(false), desktop(false),
|
||||||
@ -319,7 +319,13 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
|
|||||||
parentHandle = (HWND)prop.value<WId>();
|
parentHandle = (HWND)prop.value<WId>();
|
||||||
}
|
}
|
||||||
|
|
||||||
topLevel = ((creationFlags & ForceChild) || embedded) ? false : w->isTopLevel();
|
if (creationFlags & ForceChild) {
|
||||||
|
topLevel = false;
|
||||||
|
} else if (creationFlags & ForceTopLevel) {
|
||||||
|
topLevel = true;
|
||||||
|
} else {
|
||||||
|
topLevel = w->isTopLevel();
|
||||||
|
}
|
||||||
|
|
||||||
if (topLevel && flags == 1) {
|
if (topLevel && flags == 1) {
|
||||||
flags |= Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint
|
flags |= Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint
|
||||||
@ -984,10 +990,9 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const
|
|||||||
|
|
||||||
// WS_CHILD/WS_POPUP must be manually set/cleared in addition
|
// WS_CHILD/WS_POPUP must be manually set/cleared in addition
|
||||||
// to dialog frames, etc (see SetParent() ) if the top level state changes.
|
// to dialog frames, etc (see SetParent() ) if the top level state changes.
|
||||||
if (wasTopLevel != isTopLevel) {
|
// Force toplevel state as QWindow::isTopLevel cannot be relied upon here.
|
||||||
const unsigned flags = isTopLevel ? unsigned(0) : unsigned(WindowCreationData::ForceChild);
|
if (wasTopLevel != isTopLevel)
|
||||||
setWindowFlags_sys(window()->flags(), flags);
|
setWindowFlags_sys(window()->flags(), unsigned(isTopLevel ? WindowCreationData::ForceTopLevel : WindowCreationData::ForceChild));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user