1 appmenu-qt patch for Qt 4.7.3.
3 diff --git a/src/gui/widgets/qabstractplatformmenubar_p.h b/src/gui/widgets/qabstractplatformmenubar_p.h
7 +++ b/src/gui/widgets/qabstractplatformmenubar_p.h
9 +/****************************************************************************
11 +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
12 +** All rights reserved.
13 +** Contact: Nokia Corporation (qt-info@nokia.com)
15 +** This file is part of the QtGui module of the Qt Toolkit.
17 +** $QT_BEGIN_LICENSE:LGPL$
18 +** No Commercial Usage
19 +** This file contains pre-release code and may not be distributed.
20 +** You may use this file in accordance with the terms and conditions
21 +** contained in the Technology Preview License Agreement accompanying
24 +** GNU Lesser General Public License Usage
25 +** Alternatively, this file may be used under the terms of the GNU Lesser
26 +** General Public License version 2.1 as published by the Free Software
27 +** Foundation and appearing in the file LICENSE.LGPL included in the
28 +** packaging of this file. Please review the following information to
29 +** ensure the GNU Lesser General Public License version 2.1 requirements
30 +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
32 +** In addition, as a special exception, Nokia gives you certain additional
33 +** rights. These rights are described in the Nokia Qt LGPL Exception
34 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
36 +** If you have questions regarding the use of this file, please contact
37 +** Nokia at qt-info@nokia.com.
48 +****************************************************************************/
49 +#ifndef QABSTRACTPLATFORMMENUBAR_P_H
50 +#define QABSTRACTPLATFORMMENUBAR_P_H
52 +#include <qfactoryinterface.h>
56 +#ifndef QT_NO_MENUBAR
67 +class QAbstractPlatformMenuBar;
69 +struct QPlatformMenuBarFactoryInterface : public QFactoryInterface
71 + virtual QAbstractPlatformMenuBar *create() = 0;
74 +#define QPlatformMenuBarFactoryInterface_iid "com.nokia.qt.QPlatformMenuBarFactoryInterface"
75 +Q_DECLARE_INTERFACE(QPlatformMenuBarFactoryInterface, QPlatformMenuBarFactoryInterface_iid)
78 + The platform-specific implementation of a menubar
80 +class QAbstractPlatformMenuBar
83 + virtual ~QAbstractPlatformMenuBar() {}
85 + virtual void init(QMenuBar *) = 0;
87 + virtual void setVisible(bool visible) = 0;
89 + virtual void actionEvent(QActionEvent *) = 0;
91 + virtual void handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow) = 0;
93 + virtual bool allowCornerWidgets() const = 0;
95 + virtual void popupAction(QAction *) = 0;
97 + virtual void setNativeMenuBar(bool) = 0;
99 + virtual bool isNativeMenuBar() const = 0;
102 + Return true if the native menubar is capable of listening to the
103 + shortcut keys. If false is returned, QMenuBar will trigger actions on
106 + virtual bool shortcutsHandledByNativeMenuBar() const = 0;
108 + virtual bool menuBarEventFilter(QObject *, QEvent *event) = 0;
113 +#endif // QT_NO_MENUBAR
115 +#endif // QABSTRACTPLATFORMMENUBAR_P_H
116 diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
117 index 9f7b130..ef8c0bf 100644
118 --- a/src/gui/widgets/qmenu_mac.mm
119 +++ b/src/gui/widgets/qmenu_mac.mm
120 @@ -1643,7 +1643,7 @@ QMenuBarPrivate::QMacMenuBarPrivate::~QMacMenuBarPrivate()
124 -QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QMacMenuAction *before)
125 +QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QAction *before)
127 if (a->isSeparator() || !menu)
129 @@ -1653,7 +1653,7 @@ QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QMacMenuAction *befor
130 #ifndef QT_MAC_USE_COCOA
131 action->command = qt_mac_menu_static_cmd_id++;
133 - addAction(action, before);
134 + addAction(action, findAction(before));
138 diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h
139 index 809555d..6be7da9 100644
140 --- a/src/gui/widgets/qmenu_p.h
141 +++ b/src/gui/widgets/qmenu_p.h
142 @@ -154,6 +154,9 @@ public:
144 scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
145 hasCheckableItems(0), sloppyAction(0), doChildEffects(false)
147 + ,emitHighlighted(false)
152 @@ -163,9 +166,6 @@ public:
157 - ,emitHighlighted(false)
162 diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
163 index 2f9ada6..6fadc34 100644
164 --- a/src/gui/widgets/qmenu_symbian.cpp
165 +++ b/src/gui/widgets/qmenu_symbian.cpp
166 @@ -397,12 +397,12 @@ void QMenuPrivate::QSymbianMenuPrivate::rebuild(bool)
170 -void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QSymbianMenuAction *before)
171 +void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QAction *before)
173 QSymbianMenuAction *action = new QSymbianMenuAction;
175 action->command = qt_symbian_menu_static_cmd_id++;
176 - addAction(action, before);
177 + addAction(action, findAction(before));
180 void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QSymbianMenuAction *action, QSymbianMenuAction *before)
181 diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp
182 index 24df6a2..383820a 100644
183 --- a/src/gui/widgets/qmenu_wince.cpp
184 +++ b/src/gui/widgets/qmenu_wince.cpp
185 @@ -506,12 +506,12 @@ void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action)
189 -void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QWceMenuAction *before)
190 +void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before)
192 QWceMenuAction *action = new QWceMenuAction;
194 action->command = qt_wce_menu_static_cmd_id++;
195 - addAction(action, before);
196 + addAction(action, findAction(before));
199 void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before)
200 diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
201 index 6a41c74..4d42ac4 100644
202 --- a/src/gui/widgets/qmenubar.cpp
203 +++ b/src/gui/widgets/qmenubar.cpp
205 #include <qtoolbar.h>
206 #include <qtoolbutton.h>
207 #include <qwhatsthis.h>
209 +#include <qpluginloader.h>
212 #ifndef QT_NO_MENUBAR
216 #include "qmenubar_p.h"
219 +#include "qmenubar_x11_p.h"
223 extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
224 @@ -173,7 +179,11 @@ void QMenuBarPrivate::updateGeometries()
226 int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q)*2);
228 - if(leftWidget || rightWidget) {
231 + platformMenuBar->allowCornerWidgets() &&
233 + (leftWidget || rightWidget)) {
234 int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q)
235 + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q);
236 int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, q)
237 @@ -204,7 +214,11 @@ void QMenuBarPrivate::updateGeometries()
238 calcActionRects(q_width, q_start);
240 #ifndef QT_NO_SHORTCUT
244 + !platformMenuBar->shortcutsHandledByNativeMenuBar() &&
247 for(int j = 0; j < shortcutIndexMap.size(); ++j)
248 q->releaseShortcut(shortcutIndexMap.value(j));
249 shortcutIndexMap.resize(0); // faster than clear
250 @@ -212,6 +226,12 @@ void QMenuBarPrivate::updateGeometries()
251 shortcutIndexMap.append(q->grabShortcut(QKeySequence::mnemonic(actions.at(i)->text())));
255 + if(q->isNativeMenuBar()) {//nothing to see here folks, move along..
256 + itemsDirty = false;
262 hiddenActions.clear();
263 @@ -743,6 +763,11 @@ void QMenuBarPrivate::init()
264 QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);
268 + platformMenuBar = qt_guiPlatformMenuBarFactory()->create();
269 + platformMenuBar->init(q);
272 q->setBackgroundRole(QPalette::Button);
273 oldWindow = oldParent = 0;
275 @@ -751,6 +776,10 @@ void QMenuBarPrivate::init()
276 #ifdef QT_SOFTKEYS_ENABLED
280 + cornerWidgetToolBar = 0;
281 + cornerWidgetContainer = 0;
284 q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q));
286 @@ -821,6 +850,10 @@ QMenuBar::~QMenuBar()
288 d->symbianDestroyMenuBar();
292 + delete d->cornerWidgetToolBar;
297 @@ -1072,11 +1105,16 @@ void QMenuBar::paintEvent(QPaintEvent *e)
299 void QMenuBar::setVisible(bool visible)
303 + d->platformMenuBar->setVisible(visible);
305 #if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
306 if (isNativeMenuBar())
309 QWidget::setVisible(visible);
314 @@ -1272,6 +1310,9 @@ void QMenuBar::actionEvent(QActionEvent *e)
317 d->itemsDirty = true;
319 + d->platformMenuBar->actionEvent(e);
321 #if defined (Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
322 if (isNativeMenuBar()) {
324 @@ -1284,7 +1325,7 @@ void QMenuBar::actionEvent(QActionEvent *e)
327 if(e->type() == QEvent::ActionAdded)
328 - nativeMenuBar->addAction(e->action(), nativeMenuBar->findAction(e->before()));
329 + nativeMenuBar->addAction(e->action(), e->before());
330 else if(e->type() == QEvent::ActionRemoved)
331 nativeMenuBar->removeAction(e->action());
332 else if(e->type() == QEvent::ActionChanged)
333 @@ -1366,6 +1407,10 @@ void QMenuBarPrivate::handleReparent()
334 newWindow->installEventFilter(q);
338 + platformMenuBar->handleReparent(oldParent, newParent, oldWindow, newWindow);
341 oldParent = newParent;
342 oldWindow = newWindow;
344 @@ -1563,6 +1608,11 @@ bool QMenuBar::event(QEvent *e)
345 bool QMenuBar::eventFilter(QObject *object, QEvent *event)
349 + if (d->platformMenuBar->menuBarEventFilter(object, event)) {
353 if (object == parent() && object) {
355 if (d->doAutoResize && event->type() == QEvent::Resize) {
356 @@ -1656,7 +1706,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const
357 QSize QMenuBar::minimumSizeHint() const
360 -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60)
361 +#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11)
362 const bool as_gui_menubar = !isNativeMenuBar();
364 const bool as_gui_menubar = true;
365 @@ -1679,6 +1729,9 @@ QSize QMenuBar::minimumSizeHint() const
366 ret += QSize(2*fw + hmargin, 2*fw + vmargin);
368 int margin = 2*vmargin + 2*fw + spaceBelowMenuBar;
370 + if (d->platformMenuBar->allowCornerWidgets()) {
373 QSize sz = d->leftWidget->minimumSizeHint();
374 ret.setWidth(ret.width() + sz.width());
375 @@ -1691,6 +1744,9 @@ QSize QMenuBar::minimumSizeHint() const
376 if(sz.height() + margin > ret.height())
377 ret.setHeight(sz.height() + margin);
383 QStyleOptionMenuItem opt;
385 @@ -1712,7 +1768,7 @@ QSize QMenuBar::minimumSizeHint() const
386 QSize QMenuBar::sizeHint() const
389 -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60)
390 +#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11)
391 const bool as_gui_menubar = !isNativeMenuBar();
393 const bool as_gui_menubar = true;
394 @@ -1738,6 +1794,9 @@ QSize QMenuBar::sizeHint() const
395 ret += QSize(fw + hmargin, fw + vmargin);
397 int margin = 2*vmargin + 2*fw + spaceBelowMenuBar;
399 + if(d->platformMenuBar->allowCornerWidgets()) {
402 QSize sz = d->leftWidget->sizeHint();
403 ret.setWidth(ret.width() + sz.width());
404 @@ -1750,6 +1809,9 @@ QSize QMenuBar::sizeHint() const
405 if(sz.height() + margin > ret.height())
406 ret.setHeight(sz.height() + margin);
412 QStyleOptionMenuItem opt;
414 @@ -1771,7 +1833,7 @@ QSize QMenuBar::sizeHint() const
415 int QMenuBar::heightForWidth(int) const
418 -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60)
419 +#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11)
420 const bool as_gui_menubar = !isNativeMenuBar();
422 const bool as_gui_menubar = true;
423 @@ -1791,10 +1853,16 @@ int QMenuBar::heightForWidth(int) const
426 int margin = 2*vmargin + 2*fw + spaceBelowMenuBar;
428 + if(d->platformMenuBar->allowCornerWidgets()) {
431 height = qMax(d->leftWidget->sizeHint().height() + margin, height);
433 height = qMax(d->rightWidget->sizeHint().height() + margin, height);
438 QStyleOptionMenuItem opt;
440 @@ -1814,7 +1882,15 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id)
443 QAction *act = actions.at(id);
444 - setCurrentAction(act, true, true);
446 + if (q->isNativeMenuBar()) {
447 + platformMenuBar->popupAction(act);
450 + setCurrentAction(act, true, true);
454 if (act && !act->menu()) {
455 activateAction(act, QAction::Trigger);
456 //100 is the same as the default value in QPushButton::animateClick
457 @@ -1835,6 +1911,39 @@ void QMenuBarPrivate::_q_updateLayout()
462 +void QMenuBarPrivate::updateCornerWidgetToolBar()
465 + if (!cornerWidgetToolBar) {
466 + QMainWindow *window = qobject_cast<QMainWindow *>(q->window());
468 + qWarning() << "Menubar parent is not a QMainWindow, not showing corner widgets";
471 + cornerWidgetToolBar = window->addToolBar(QApplication::translate("QMenuBar", "Corner Toolbar"));
472 + cornerWidgetToolBar->setObjectName(QLatin1String("CornerToolBar"));
473 + cornerWidgetContainer = new QWidget;
474 + cornerWidgetToolBar->addWidget(cornerWidgetContainer);
475 + new QHBoxLayout(cornerWidgetContainer);
477 + QLayout *layout = cornerWidgetContainer->layout();
478 + while (layout->count() > 0) {
483 + leftWidget->setParent(cornerWidgetContainer);
484 + cornerWidgetContainer->layout()->addWidget(leftWidget);
487 + rightWidget->setParent(cornerWidgetContainer);
488 + cornerWidgetContainer->layout()->addWidget(rightWidget);
495 \fn void QMenuBar::setCornerWidget(QWidget *widget, Qt::Corner corner)
497 @@ -1867,10 +1976,18 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner)
502 + if(!d->platformMenuBar->allowCornerWidgets()) {
503 + d->updateCornerWidgetToolBar();
508 w->installEventFilter(this);
514 d->_q_updateLayout();
516 @@ -1920,6 +2037,9 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const
517 void QMenuBar::setNativeMenuBar(bool nativeMenuBar)
521 + d->platformMenuBar->setNativeMenuBar(nativeMenuBar);
523 if (d->nativeMenuBar == -1 || (nativeMenuBar != bool(d->nativeMenuBar))) {
524 d->nativeMenuBar = nativeMenuBar;
526 @@ -1944,15 +2064,20 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar)
533 bool QMenuBar::isNativeMenuBar() const
537 + return d->platformMenuBar->isNativeMenuBar();
539 if (d->nativeMenuBar == -1) {
540 return !QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar);
542 return d->nativeMenuBar;
547 diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h
548 index 1ac694e..9a1f758 100644
549 --- a/src/gui/widgets/qmenubar_p.h
550 +++ b/src/gui/widgets/qmenubar_p.h
554 // This file is not part of the Qt API. It exists purely as an
555 -// implementation detail. This header file may change from version to
556 +// platformMenuBarementation detail. This header file may change from version to
557 // version without notice, or even be removed.
561 #include "qguifunctions_wince.h"
565 +#include "qabstractplatformmenubar_p.h"
568 #ifndef QT_NO_MENUBAR
571 @@ -71,21 +75,27 @@ class CEikMenuBar;
574 #ifndef QT_NO_MENUBAR
576 class QMenuBarExtension;
577 class QMenuBarPrivate : public QWidgetPrivate
579 Q_DECLARE_PUBLIC(QMenuBar)
581 QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0),
582 - closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0),
583 - nativeMenuBar(-1), doChildEffects(false)
584 + closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0)
586 + , nativeMenuBar(-1)
588 + , doChildEffects(false)
590 , doAutoResize(false)
597 + , platformMenuBar(0)
600 , wce_menubar(0), wceClassicMenu(false)
602 @@ -96,6 +106,9 @@ public:
607 + delete platformMenuBar;
612 @@ -136,8 +149,9 @@ public:
613 uint keyboardState : 1, altPressed : 1;
614 QPointer<QWidget> keyboardFocusWidget;
618 int nativeMenuBar : 3; // Only has values -1, 0, and 1
621 void activateAction(QAction *, QAction::ActionEvent);
623 @@ -173,6 +187,9 @@ public:
628 + QAbstractPlatformMenuBar *platformMenuBar;
631 //mac menubar binding
632 struct QMacMenuBarPrivate {
633 @@ -181,7 +198,7 @@ public:
634 QMacMenuBarPrivate();
635 ~QMacMenuBarPrivate();
637 - void addAction(QAction *, QMacMenuAction* =0);
638 + void addAction(QAction *, QAction* =0);
639 void addAction(QMacMenuAction *, QMacMenuAction* =0);
640 void syncAction(QMacMenuAction *);
641 inline void syncAction(QAction *a) { syncAction(findAction(a)); }
642 @@ -220,7 +237,7 @@ public:
644 QWceMenuBarPrivate(QMenuBarPrivate *menubar);
645 ~QWceMenuBarPrivate();
646 - void addAction(QAction *, QWceMenuAction* =0);
647 + void addAction(QAction *, QAction* =0);
648 void addAction(QWceMenuAction *, QWceMenuAction* =0);
649 void syncAction(QWceMenuAction *);
650 inline void syncAction(QAction *a) { syncAction(findAction(a)); }
651 @@ -250,7 +267,7 @@ public:
653 QSymbianMenuBarPrivate(QMenuBarPrivate *menubar);
654 ~QSymbianMenuBarPrivate();
655 - void addAction(QAction *, QSymbianMenuAction* =0);
656 + void addAction(QAction *, QAction* =0);
657 void addAction(QSymbianMenuAction *, QSymbianMenuAction* =0);
658 void syncAction(QSymbianMenuAction *);
659 inline void syncAction(QAction *a) { syncAction(findAction(a)); }
660 @@ -273,6 +290,12 @@ public:
661 #ifdef QT_SOFTKEYS_ENABLED
662 QAction *menuBarAction;
666 + void updateCornerWidgetToolBar();
667 + QToolBar *cornerWidgetToolBar;
668 + QWidget *cornerWidgetContainer;
673 diff --git a/src/gui/widgets/qmenubar_x11.cpp b/src/gui/widgets/qmenubar_x11.cpp
675 index 0000000..37c085f
677 +++ b/src/gui/widgets/qmenubar_x11.cpp
679 +/****************************************************************************
681 +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
682 +** All rights reserved.
683 +** Contact: Nokia Corporation (qt-info@nokia.com)
685 +** This file is part of the QtGui module of the Qt Toolkit.
687 +** $QT_BEGIN_LICENSE:LGPL$
688 +** No Commercial Usage
689 +** This file contains pre-release code and may not be distributed.
690 +** You may use this file in accordance with the terms and conditions
691 +** contained in the Technology Preview License Agreement accompanying
694 +** GNU Lesser General Public License Usage
695 +** Alternatively, this file may be used under the terms of the GNU Lesser
696 +** General Public License version 2.1 as published by the Free Software
697 +** Foundation and appearing in the file LICENSE.LGPL included in the
698 +** packaging of this file. Please review the following information to
699 +** ensure the GNU Lesser General Public License version 2.1 requirements
700 +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
702 +** In addition, as a special exception, Nokia gives you certain additional
703 +** rights. These rights are described in the Nokia Qt LGPL Exception
704 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
706 +** If you have questions regarding the use of this file, please contact
707 +** Nokia at qt-info@nokia.com.
718 +****************************************************************************/
719 +#include "qmenubar_x11_p.h"
721 +#ifndef QT_NO_MENUBAR
723 +#include "qapplication.h"
727 +#include "qmenubar.h"
729 +#include <private/qfactoryloader_p.h>
733 +QX11MenuBar::~QX11MenuBar()
737 +void QX11MenuBar::init(QMenuBar *_menuBar)
739 + nativeMenuBar = -1;
740 + menuBar = _menuBar;
743 +void QX11MenuBar::setVisible(bool visible)
745 + menuBar->QWidget::setVisible(visible);
748 +void QX11MenuBar::actionEvent(QActionEvent *e)
753 +void QX11MenuBar::handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow)
755 + Q_UNUSED(oldParent)
756 + Q_UNUSED(newParent)
757 + Q_UNUSED(oldWindow)
758 + Q_UNUSED(newWindow)
761 +bool QX11MenuBar::allowCornerWidgets() const
766 +void QX11MenuBar::popupAction(QAction *)
770 +void QX11MenuBar::setNativeMenuBar(bool value)
772 + if (nativeMenuBar == -1 || (value != bool(nativeMenuBar))) {
773 + nativeMenuBar = value;
777 +bool QX11MenuBar::isNativeMenuBar() const
782 +bool QX11MenuBar::shortcutsHandledByNativeMenuBar() const
787 +bool QX11MenuBar::menuBarEventFilter(QObject *, QEvent *)
792 +struct QX11MenuBarFactory : public QPlatformMenuBarFactoryInterface
794 + QAbstractPlatformMenuBar *create() { return new QX11MenuBar; }
795 + virtual QStringList keys() const { return QStringList(); }
798 +QPlatformMenuBarFactoryInterface *qt_guiPlatformMenuBarFactory()
800 + static QPlatformMenuBarFactoryInterface *factory = 0;
802 +#ifndef QT_NO_LIBRARY
803 + QFactoryLoader loader(QPlatformMenuBarFactoryInterface_iid, QLatin1String("/menubar"));
804 + factory = qobject_cast<QPlatformMenuBarFactoryInterface *>(loader.instance(QLatin1String("default")));
805 +#endif // QT_NO_LIBRARY
807 + static QX11MenuBarFactory def;
816 +#endif // QT_NO_MENUBAR
817 diff --git a/src/gui/widgets/qmenubar_x11_p.h b/src/gui/widgets/qmenubar_x11_p.h
819 index 0000000..1c43b04
821 +++ b/src/gui/widgets/qmenubar_x11_p.h
823 +/****************************************************************************
825 +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
826 +** All rights reserved.
827 +** Contact: Nokia Corporation (qt-info@nokia.com)
829 +** This file is part of the QtGui module of the Qt Toolkit.
831 +** $QT_BEGIN_LICENSE:LGPL$
832 +** No Commercial Usage
833 +** This file contains pre-release code and may not be distributed.
834 +** You may use this file in accordance with the terms and conditions
835 +** contained in the Technology Preview License Agreement accompanying
838 +** GNU Lesser General Public License Usage
839 +** Alternatively, this file may be used under the terms of the GNU Lesser
840 +** General Public License version 2.1 as published by the Free Software
841 +** Foundation and appearing in the file LICENSE.LGPL included in the
842 +** packaging of this file. Please review the following information to
843 +** ensure the GNU Lesser General Public License version 2.1 requirements
844 +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
846 +** In addition, as a special exception, Nokia gives you certain additional
847 +** rights. These rights are described in the Nokia Qt LGPL Exception
848 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
850 +** If you have questions regarding the use of this file, please contact
851 +** Nokia at qt-info@nokia.com.
862 +****************************************************************************/
863 +#ifndef QX11MENUBAR_P_H
864 +#define QX11MENUBAR_P_H
866 +#ifndef QT_NO_MENUBAR
868 +#include "qabstractplatformmenubar_p.h"
874 +class QX11MenuBar : public QAbstractPlatformMenuBar
879 + virtual void init(QMenuBar *);
881 + virtual void setVisible(bool visible);
883 + virtual void actionEvent(QActionEvent *e);
885 + virtual void handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow);
887 + virtual bool allowCornerWidgets() const;
889 + virtual void popupAction(QAction*);
891 + virtual void setNativeMenuBar(bool);
892 + virtual bool isNativeMenuBar() const;
894 + virtual bool shortcutsHandledByNativeMenuBar() const;
895 + virtual bool menuBarEventFilter(QObject *, QEvent *event);
899 + int nativeMenuBar : 3; // Only has values -1, 0, and 1
902 +QPlatformMenuBarFactoryInterface *qt_guiPlatformMenuBarFactory();
906 +#endif // QT_NO_MENUBAR
908 +#endif /* QX11MENUBAR_P_H */
909 diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri
910 index 937b8d6..bd8a735 100644
911 --- a/src/gui/widgets/widgets.pri
912 +++ b/src/gui/widgets/widgets.pri
913 @@ -144,6 +144,14 @@ SOURCES += \
914 widgets/qplaintextedit.cpp \
915 widgets/qprintpreviewwidget.cpp
919 + widgets/qabstractplatformmenubar_p.h
922 + widgets/qmenubar_x11.cpp
926 HEADERS += widgets/qmacnativewidget_mac.h \
927 widgets/qmaccocoaviewcontainer_mac.h