Add support to disable close button from the tool window in Cocoa.

Fixed regression from Qt4 that close button could't be disabled
from the tool window. With this patch buttons are hidden before
using button hints like it's on Windows.

Change-Id: I00f03ff9528ccae3b1136312404452b9415953b4
Task-number: QTBUG-45971
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
bb10
Marko Kangas 2015-05-06 13:51:04 +03:00
parent 43e82a3b09
commit dd02c1eb38
1 changed files with 16 additions and 3 deletions

View File

@ -799,9 +799,22 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
if (flags & Qt::FramelessWindowHint)
return styleMask;
if ((type & Qt::Popup) == Qt::Popup) {
if (!windowIsPopupType(type))
styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSTitledWindowMask);
if (!windowIsPopupType(type)) {
styleMask = NSUtilityWindowMask;
if (!(flags & Qt::CustomizeWindowHint)) {
styleMask |= NSResizableWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSTitledWindowMask;
} else {
if (flags & Qt::WindowMaximizeButtonHint)
styleMask |= NSResizableWindowMask;
if (flags & Qt::WindowTitleHint)
styleMask |= NSTitledWindowMask;
if (flags & Qt::WindowCloseButtonHint)
styleMask |= NSClosableWindowMask;
if (flags & Qt::WindowMinimizeButtonHint)
styleMask |= NSMiniaturizableWindowMask;
}
}
} else {
if (type == Qt::Window && !(flags & Qt::CustomizeWindowHint)) {
styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask);