diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-11-04 06:38:36 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-11-04 06:38:36 (GMT) |
commit | 764f558846b8ee6f115004fc939b890991c40bfa (patch) | |
tree | 9bd47140cedbc9d8d28702618e6ad86fa6f2f666 /src/gui/widgets/qmenubar.cpp | |
parent | 9b0c0faf73dbdc382f1c02a42b10018bf9961d72 (diff) | |
parent | 1400ce5b85fbe7c67899f5f62bfd276eecb21ae0 (diff) | |
download | Qt-764f558846b8ee6f115004fc939b890991c40bfa.zip Qt-764f558846b8ee6f115004fc939b890991c40bfa.tar.gz Qt-764f558846b8ee6f115004fc939b890991c40bfa.tar.bz2 |
Merge branch '4.6' of c:\dev\qt-graphics-4.6
Conflicts:
tools/qdoc3/test/qt-build-docs.qdocconf
tools/qdoc3/test/qt-inc.qdocconf
Diffstat (limited to 'src/gui/widgets/qmenubar.cpp')
-rw-r--r-- | src/gui/widgets/qmenubar.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index f2f0722..689d2e1 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -336,30 +336,25 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) const bool fitUp = (q->mapToGlobal(adjustedActionRect.topLeft()).y() >= popup_size.height()); const bool fitDown = (pos.y() + popup_size.height() <= screenRect.bottom()); + const bool rtl = q->isRightToLeft(); const int actionWidth = adjustedActionRect.width(); if (!fitUp && !fitDown) { //we should shift the menu - bool shouldShiftToRight = !q->isRightToLeft(); - if (q->isRightToLeft() && popup_size.width() > pos.x()) + bool shouldShiftToRight = !rtl; + if (rtl && popup_size.width() > pos.x()) shouldShiftToRight = true; else if (actionWidth + popup_size.width() + pos.x() > screenRect.right()) shouldShiftToRight = false; - if (shouldShiftToRight) - pos.rx() += actionWidth; - else - pos.rx() -= popup_size.width(); - } else if (q->isRightToLeft()) { - pos.setX(pos.x()-(popup_size.width() - actionWidth)); - } - - if(pos.x() < screenRect.x()) { - pos.setX(screenRect.x()); - } else { - const int off = pos.x()+popup_size.width() - screenRect.right(); - if(off > 0) - pos.setX(qMax(screenRect.x(), pos.x()-off)); - + if (shouldShiftToRight) { + pos.rx() += actionWidth + (rtl ? popup_size.width() : 0); + } else { + //shift to left + if (!rtl) + pos.rx() -= popup_size.width(); + } + } else if (rtl) { + pos.rx() += actionWidth; } if(!defaultPopDown || (fitUp && !fitDown)) |