diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-04-07 14:44:59 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-04-07 14:47:02 (GMT) |
commit | 864ace14e12cedd8e8f78841249e5309eb0a0795 (patch) | |
tree | 62bd2272e16dec85dcf49e5acc499c92f949eac1 /src/gui/widgets/qmenubar.cpp | |
parent | 2df78bfc92bdf6da1de87ae684b4c59b70767f90 (diff) | |
download | Qt-864ace14e12cedd8e8f78841249e5309eb0a0795.zip Qt-864ace14e12cedd8e8f78841249e5309eb0a0795.tar.gz Qt-864ace14e12cedd8e8f78841249e5309eb0a0795.tar.bz2 |
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
Diffstat (limited to 'src/gui/widgets/qmenubar.cpp')
-rw-r--r-- | src/gui/widgets/qmenubar.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index e368d3d..a13a2fa 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); } } |