summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-04-07 14:44:59 (GMT)
committerSamuli Piippo <samuli.piippo@digia.com>2011-06-09 10:05:34 (GMT)
commit67ac68f4518b15d97d39d978294845c6b7956794 (patch)
treed0957ec704861cfdb5a8697af3481620848ee4e6 /src
parent9fa3643a4fb707958ea43fda14e6eddc18bc9a1d (diff)
downloadQt-67ac68f4518b15d97d39d978294845c6b7956794.zip
Qt-67ac68f4518b15d97d39d978294845c6b7956794.tar.gz
Qt-67ac68f4518b15d97d39d978294845c6b7956794.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 (cherry picked from commit 864ace14e12cedd8e8f78841249e5309eb0a0795)
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qmenubar.cpp11
1 files 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<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);
}
}