Cocoa: Handle Qt::WA_MacAlwaysShowToolWindow

Forward the flag to QWindow by setting the _q_macAlwaysShowToolWindowproperty
on the window in QWidgetPrivate::create_sys(). Test
for the property when creating the window.

Task-number: QTBUG-29816
Done-with: Morten Sørvig
Change-Id: Id810dda98d02deb0902192cce1783d8b16b04d04
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
bb10
Shawn Rutledge 2014-10-29 08:44:40 +01:00
parent 933fab137d
commit 3d5fb54eda
2 changed files with 7 additions and 1 deletions

View File

@ -1400,7 +1400,11 @@ QCocoaNSWindow * QCocoaWindow::createNSWindow()
if ((type & Qt::Popup) == Qt::Popup)
[window setHasShadow:YES];
[window setHidesOnDeactivate:(type & Qt::Tool) == Qt::Tool];
// Qt::Tool windows hide on app deactivation, unless Qt::WA_MacAlwaysShowToolWindow is set.
QVariant showWithoutActivating = QPlatformWindow::window()->property("_q_macAlwaysShowToolWindow");
bool shouldHideOnDeactivate = ((type & Qt::Tool) == Qt::Tool) &&
!(showWithoutActivating.isValid() && showWithoutActivating.toBool());
[window setHidesOnDeactivate: shouldHideOnDeactivate];
// Make popup windows show on the same desktop as the parent full-screen window.
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];

View File

@ -1405,6 +1405,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (q->testAttribute(Qt::WA_ShowWithoutActivating))
win->setProperty("_q_showWithoutActivating", QVariant(true));
if (q->testAttribute(Qt::WA_MacAlwaysShowToolWindow))
win->setProperty("_q_macAlwaysShowToolWindow", QVariant::fromValue(QVariant(true)));
win->setFlags(data.window_flags);
fixPosIncludesFrame();
if (q->testAttribute(Qt::WA_Moved)