From 67ac68f4518b15d97d39d978294845c6b7956794 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 7 Apr 2010 16:44:59 +0200 Subject: Fixed the action geometry of menu bar in RTL It could happen (with MDI widgets) that the first actions would not be visible. Task-number: QTBUG-9560 Reviewed-by: gabi (cherry picked from commit 864ace14e12cedd8e8f78841249e5309eb0a0795) --- src/gui/widgets/qmenubar.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 1f391d4..5776565 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(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); } } -- cgit v0.12