summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/widgets/qmainwindow.cpp6
-rw-r--r--src/widgets/widgets/qtoolbar.cpp18
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp4
3 files changed, 23 insertions, 5 deletions
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 1d0268a244..90cfb1d7cb 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -1513,12 +1513,12 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
- nativeInterface->nativeResourceFunctionForIntegration("enableContentBorderArea");
+ nativeInterface->nativeResourceFunctionForIntegration("setContentBorderEnabled");
if (!function)
return; // Not Cocoa platform plugin.
- typedef void (*EnableContentBorderAreaFunction)(QWindow *window, bool enable);
- (reinterpret_cast<EnableContentBorderAreaFunction>(function))(window()->windowHandle(), set);
+ typedef void (*SetContentBorderEnabledFunction)(QWindow *window, bool enable);
+ (reinterpret_cast<SetContentBorderEnabledFunction>(function))(window()->windowHandle(), set);
}
#endif
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 53b77c34da..3fd615c3c7 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -1040,6 +1040,21 @@ static bool waitForPopup(QToolBar *tb, QWidget *popup)
return false;
}
+#ifdef Q_OS_OSX
+static void enableMacToolBar(QToolBar *toolbar, bool enable)
+{
+ QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface();
+ QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
+ nativeInterface->nativeResourceFunctionForIntegration("setContentBorderAreaEnabled");
+ if (!function)
+ return; // Not Cocoa platform plugin.
+
+ typedef void (*SetContentBorderAreaEnabledFunction)(QWindow *window, void *identifier, bool enabled);
+ (reinterpret_cast<SetContentBorderAreaEnabledFunction>(function))(toolbar->window()->windowHandle(), toolbar, enable);
+}
+#endif
+
+
/*! \reimp */
bool QToolBar::event(QEvent *event)
{
@@ -1062,6 +1077,9 @@ bool QToolBar::event(QEvent *event)
// fallthrough intended
case QEvent::Show:
d->toggleViewAction->setChecked(event->type() == QEvent::Show);
+#ifdef Q_OS_OSX
+ enableMacToolBar(this, event->type() == QEvent::Show);
+#endif
emit visibilityChanged(event->type() == QEvent::Show);
break;
case QEvent::ParentChange:
diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp
index 020d180778..efd33da7fc 100644
--- a/src/widgets/widgets/qtoolbarlayout.cpp
+++ b/src/widgets/widgets/qtoolbarlayout.cpp
@@ -369,9 +369,9 @@ void QToolBarLayout::updateMacBorderMetrics()
typedef void (*RegisterContentBorderAreaFunction)(QWindow *window, void *identifier, int upper, int lower);
if (mainWindow->toolBarArea(tb) == Qt::TopToolBarArea) {
- (reinterpret_cast<RegisterContentBorderAreaFunction>(function))(tb->window()->windowHandle(), this, upper.y(), lower.y());
+ (reinterpret_cast<RegisterContentBorderAreaFunction>(function))(tb->window()->windowHandle(), tb, upper.y(), lower.y());
} else {
- (reinterpret_cast<RegisterContentBorderAreaFunction>(function))(tb->window()->windowHandle(), this, 0, 0);
+ (reinterpret_cast<RegisterContentBorderAreaFunction>(function))(tb->window()->windowHandle(), tb, 0, 0);
}
#endif
}