summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmenubar.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-11 17:19:29 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-11 17:19:29 (GMT)
commit8c13e18eb49ab9ab42db4359f0ccc91de5c72818 (patch)
tree17dbc029e37835594ad29d586f3fc7ec8013b65a /src/gui/widgets/qmenubar.cpp
parentde76200652e05de34d99f111c64a051a49911034 (diff)
parent2d63f8fe5b77747014e1c5807c9d457611bd9304 (diff)
downloadQt-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.cpp4
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());