equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
63 #include <private/qt_cocoa_helpers_mac_p.h> |
63 #include <private/qt_cocoa_helpers_mac_p.h> |
64 QT_BEGIN_NAMESPACE |
64 QT_BEGIN_NAMESPACE |
65 extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp |
65 extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp |
66 QT_END_NAMESPACE |
66 QT_END_NAMESPACE |
67 #endif |
67 #endif |
68 #ifdef QT_SOFTKEYS_ENABLED |
|
69 #include <private/qsoftkeymanager_p.h> |
|
70 #endif |
|
71 |
68 |
72 QT_BEGIN_NAMESPACE |
69 QT_BEGIN_NAMESPACE |
73 |
70 |
74 class QMainWindowPrivate : public QWidgetPrivate |
71 class QMainWindowPrivate : public QWidgetPrivate |
75 { |
72 { |
77 public: |
74 public: |
78 inline QMainWindowPrivate() |
75 inline QMainWindowPrivate() |
79 : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) |
76 : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) |
80 #ifdef Q_WS_MAC |
77 #ifdef Q_WS_MAC |
81 , useHIToolBar(false) |
78 , useHIToolBar(false) |
82 #endif |
|
83 #ifdef QT_SOFTKEYS_ENABLED |
|
84 , menuBarAction(0) |
|
85 #endif |
79 #endif |
86 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) |
80 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) |
87 , hasOldCursor(false) , cursorAdjusted(false) |
81 , hasOldCursor(false) , cursorAdjusted(false) |
88 #endif |
82 #endif |
89 { } |
83 { } |
92 bool explicitIconSize; |
86 bool explicitIconSize; |
93 Qt::ToolButtonStyle toolButtonStyle; |
87 Qt::ToolButtonStyle toolButtonStyle; |
94 #ifdef Q_WS_MAC |
88 #ifdef Q_WS_MAC |
95 bool useHIToolBar; |
89 bool useHIToolBar; |
96 #endif |
90 #endif |
97 #ifdef QT_SOFTKEYS_ENABLED |
|
98 QAction *menuBarAction; |
|
99 #endif |
|
100 void init(); |
91 void init(); |
101 QList<int> hoverSeparator; |
92 QList<int> hoverSeparator; |
102 QPoint hoverPos; |
93 QPoint hoverPos; |
103 |
94 |
104 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) |
95 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) |
115 Q_Q(QMainWindow); |
106 Q_Q(QMainWindow); |
116 layout = new QMainWindowLayout(q); |
107 layout = new QMainWindowLayout(q); |
117 const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); |
108 const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); |
118 iconSize = QSize(metric, metric); |
109 iconSize = QSize(metric, metric); |
119 q->setAttribute(Qt::WA_Hover); |
110 q->setAttribute(Qt::WA_Hover); |
120 #ifdef QT_SOFTKEYS_ENABLED |
|
121 menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q); |
|
122 menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction")); |
|
123 menuBarAction->setVisible(false); |
|
124 #endif |
|
125 } |
111 } |
126 |
112 |
127 /* |
113 /* |
128 The Main Window: |
114 The Main Window: |
129 |
115 |
491 } |
477 } |
492 oldMenuBar->hide(); |
478 oldMenuBar->hide(); |
493 oldMenuBar->deleteLater(); |
479 oldMenuBar->deleteLater(); |
494 } |
480 } |
495 d->layout->setMenuBar(menuBar); |
481 d->layout->setMenuBar(menuBar); |
496 |
|
497 #ifdef QT_SOFTKEYS_ENABLED |
|
498 if (menuBar) |
|
499 addAction(d->menuBarAction); |
|
500 else |
|
501 removeAction(d->menuBarAction); |
|
502 #endif |
|
503 } |
482 } |
504 |
483 |
505 /*! |
484 /*! |
506 \since 4.2 |
485 \since 4.2 |
507 |
486 |