diff options
Diffstat (limited to 'src/gui/widgets/qmenubar.cpp')
-rw-r--r-- | src/gui/widgets/qmenubar.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 13aa02b..ef37fd1 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -268,19 +268,15 @@ void QMenuBarPrivate::updateGeometries() QRect QMenuBarPrivate::actionRect(QAction *act) const { - Q_Q(const QMenuBar); const int index = actions.indexOf(act); - if (index == -1) - return QRect(); //makes sure the geometries are up-to-date const_cast<QMenuBarPrivate*>(this)->updateGeometries(); - if (index >= actionRects.count()) + if (index < 0 || index >= actionRects.count()) return QRect(); // that can happen in case of native menubar - QRect ret = actionRects.at(index); - return QStyle::visualRect(q->layoutDirection(), q->rect(), ret); + return actionRects.at(index); } void QMenuBarPrivate::focusFirstAction() @@ -505,6 +501,9 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const //keep moving along.. x += rect.width() + itemSpacing; + + //make sure we follow the layout direction + rect = QStyle::visualRect(q->layoutDirection(), q->rect(), rect); } } @@ -1404,7 +1403,6 @@ void QMenuBarPrivate::handleReparent() if (!menuBarAction) { if (newParent) { menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, newParent); - menuBarAction->setVisible(false); newParent->addAction(menuBarAction); } } else { @@ -1933,9 +1931,9 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar) d->macCreateMenuBar(parentWidget()); } macUpdateMenuBar(); - updateGeometry(); - setVisible(false); - setVisible(true); + updateGeometry(); + if (!d->nativeMenuBar && parentWidget()) + setVisible(true); #endif } } |