summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmainwindowlayout_mac.mm
diff options
context:
space:
mode:
authorFabien Freling <fabien.freling@nokia.com>2010-10-08 16:37:25 (GMT)
committerFabien Freling <fabien.freling@nokia.com>2010-10-08 16:37:59 (GMT)
commit1966b88611bb45d18d586847eeb3597d6e022eb7 (patch)
tree0bba3169a8bc44761686fd967f1cb25e4beca97a /src/gui/widgets/qmainwindowlayout_mac.mm
parent392ecc76cdbcef37ee492400a1b783106a37ad36 (diff)
downloadQt-1966b88611bb45d18d586847eeb3597d6e022eb7.zip
Qt-1966b88611bb45d18d586847eeb3597d6e022eb7.tar.gz
Qt-1966b88611bb45d18d586847eeb3597d6e022eb7.tar.bz2
Experimental support of the unified toolbar with
the raster engine on Mac OS X. Task-number: QTBUG-12615 Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/gui/widgets/qmainwindowlayout_mac.mm')
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 1bfc746..b2c4cea 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -49,6 +49,7 @@
#else
#include <private/qcocoatoolbardelegate_mac_p.h>
#import <private/qcocoawindowdelegate_mac_p.h>
+#include <private/qunifiedtoolbarcontainer_mac_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -408,6 +409,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
beforeIndex = qtoolbarsInUnifiedToolbarList.size();
int toolbarIndex = qtoolbarsInUnifiedToolbarList.indexOf(toolbar);
+
#ifndef QT_MAC_USE_COCOA
HIToolbarRef macToolbar = NULL;
if ((GetWindowToolbar(window, &macToolbar) == noErr) && !macToolbar) {
@@ -444,6 +446,16 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
#endif
}
qtoolbarsInUnifiedToolbarList.insert(beforeIndex, toolbar);
+
+ // Adding to the unified toolbar surface for the raster engine.
+ if (layoutState.mainWindow->windowSurface()) {
+ QPoint offset(0, 0);
+ for (int i = 0; i < beforeIndex; ++i) {
+ offset.setX(offset.x() + qtoolbarsInUnifiedToolbarList.at(i)->size().width());
+ }
+ unifiedSurface->insertToolbar(toolbar, offset);
+ }
+
#ifndef QT_MAC_USE_COCOA
QCFType<HIToolbarItemRef> outItem;
const QObject *stupidArray[] = { toolbar, this };