diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-11 17:19:29 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-11 17:19:29 (GMT) |
commit | 8c13e18eb49ab9ab42db4359f0ccc91de5c72818 (patch) | |
tree | 17dbc029e37835594ad29d586f3fc7ec8013b65a /src/gui/widgets/qmenubar.cpp | |
parent | de76200652e05de34d99f111c64a051a49911034 (diff) | |
parent | 2d63f8fe5b77747014e1c5807c9d457611bd9304 (diff) | |
download | Qt-8c13e18eb49ab9ab42db4359f0ccc91de5c72818.zip Qt-8c13e18eb49ab9ab42db4359f0ccc91de5c72818.tar.gz Qt-8c13e18eb49ab9ab42db4359f0ccc91de5c72818.tar.bz2 |
Merge commit 'widget/4.6' into oslo-staging-2/4.6
Conflicts:
src/gui/painting/qbrush.cpp
Diffstat (limited to 'src/gui/widgets/qmenubar.cpp')
-rw-r--r-- | src/gui/widgets/qmenubar.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 689d2e1..b1ff662 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -332,7 +332,9 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) QPoint pos(q->mapToGlobal(QPoint(adjustedActionRect.left(), adjustedActionRect.bottom() + 1))); QSize popup_size = activeMenu->sizeHint(); - QRect screenRect = QApplication::desktop()->screenGeometry(pos); + //we put the popup menu on the screen containing the bottom-center of the action rect + QRect screenRect = QApplication::desktop()->screenGeometry(pos + QPoint(adjustedActionRect.width() / 2, 0)); + pos = QPoint(qMax(pos.x(), screenRect.x()), qMax(pos.y(), screenRect.y())); const bool fitUp = (q->mapToGlobal(adjustedActionRect.topLeft()).y() >= popup_size.height()); const bool fitDown = (pos.y() + popup_size.height() <= screenRect.bottom()); |