Fix the window flags for Cocoa windows

This ensures that the possible window flag combinations are respected
where possible in Cocoa.

Task-number: QTBUG-34645
Task-number: QTBUG-31616
Change-Id: I6be8ca666b7cbc397575e97cd95ea298f52a7113
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Andy Shaw 2013-11-12 09:41:42 +01:00 committed by The Qt Project
parent e9af987f28
commit be405c86f8

View File

@ -470,14 +470,12 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSTitledWindowMask);
} else {
// Filter flags for supported properties
flags &= Qt::WindowType_Mask | Qt::FramelessWindowHint | Qt::WindowTitleHint |
Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint;
if (flags == Qt::Window) {
if (type == Qt::Window && !(flags & Qt::CustomizeWindowHint)) {
styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask);
} else if ((flags & Qt::Dialog) == Qt::Dialog) {
} else if (type == Qt::Dialog) {
if (flags & Qt::CustomizeWindowHint) {
styleMask = NSResizableWindowMask;
if (flags & Qt::WindowMaximizeButtonHint)
styleMask = NSResizableWindowMask;
if (flags & Qt::WindowTitleHint)
styleMask |= NSTitledWindowMask;
if (flags & Qt::WindowCloseButtonHint)
@ -488,7 +486,7 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
styleMask = NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask;
}
} else if (!(flags & Qt::FramelessWindowHint)) {
if ((flags & Qt::Dialog) || (flags & Qt::WindowMaximizeButtonHint))
if (flags & Qt::WindowMaximizeButtonHint)
styleMask |= NSResizableWindowMask;
if (flags & Qt::WindowTitleHint)
styleMask |= NSTitledWindowMask;