diff -Naur qt-x11-opensource-src-4.5.0-beta1-orig/src/gui/widgets/qmainwindow.cpp qt-x11-opensource-src-4.5.0-beta1/src/gui/widgets/qmainwindow.cpp --- qt-x11-opensource-src-4.5.0-beta1-orig/src/gui/widgets/qmainwindow.cpp 2008-12-17 20:16:41.000000000 +0300 +++ qt-x11-opensource-src-4.5.0-beta1/src/gui/widgets/qmainwindow.cpp 2009-01-03 17:54:32.000000000 +0300 @@ -300,6 +300,9 @@ : QWidget(*(new QMainWindowPrivate()), parent, flags | Qt::Window) { d_func()->init(); +#ifndef QT_NO_MENUBAR + createMenuBarAction(); +#endif // QT_NO_MENUBAR } #ifdef QT3_SUPPORT @@ -313,6 +316,9 @@ { setObjectName(QString::fromAscii(name)); d_func()->init(); +#ifndef QT_NO_MENUBAR + createMenuBarAction(); +#endif // QT_NO_MENUBAR } #endif @@ -1567,4 +1573,30 @@ QT_END_NAMESPACE +#ifndef QT_NO_MENUBAR +void QMainWindow::createMenuBarAction() +{ + QList vShortcuts; + vShortcuts.append(QKeySequence(Qt::SHIFT | Qt::Key_F10)); + vShortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Super_L)); + vShortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Super_R)); + + QAction *vpAction = new QAction(this); + vpAction->setShortcuts(vShortcuts); + connect(vpAction, SIGNAL(triggered()), this, SLOT(activateMenuBar())); + addAction(vpAction); +} + +void QMainWindow::activateMenuBar() +{ + QMenuBar *vpMenuBar = menuBar(); + if(!vpMenuBar) return; + if(vpMenuBar->actions().count()<=0) return; + + QAction *vpAction = vpMenuBar->actions().at(0); + if(!vpAction) return; + vpMenuBar->setActiveAction(vpAction); +} +#endif // QT_NO_MENUBAR + #endif // QT_NO_MAINWINDOW diff -Naur qt-x11-opensource-src-4.5.0-beta1-orig/src/gui/widgets/qmainwindow.h qt-x11-opensource-src-4.5.0-beta1/src/gui/widgets/qmainwindow.h --- qt-x11-opensource-src-4.5.0-beta1-orig/src/gui/widgets/qmainwindow.h 2008-12-17 20:16:41.000000000 +0300 +++ qt-x11-opensource-src-4.5.0-beta1/src/gui/widgets/qmainwindow.h 2009-01-03 17:54:32.000000000 +0300 @@ -196,6 +196,14 @@ #endif bool event(QEvent *event); +#ifndef QT_NO_MENUBAR +protected: + void createMenuBarAction(); + +protected Q_SLOTS: + void activateMenuBar(); +#endif + private: Q_DECLARE_PRIVATE(QMainWindow) Q_DISABLE_COPY(QMainWindow)