summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-11-10 15:21:36 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-11-10 15:23:40 (GMT)
commit642b0f063df1339bcef6e8f23d84536230131573 (patch)
treee00f099ff070c64cc2b71c273e72bac1a57ff165 /src/gui/widgets
parent6789c06291febb20987d669d0e0e58913eeb9bfe (diff)
downloadQt-642b0f063df1339bcef6e8f23d84536230131573.zip
Qt-642b0f063df1339bcef6e8f23d84536230131573.tar.gz
Qt-642b0f063df1339bcef6e8f23d84536230131573.tar.bz2
Menubars in dual screen mode now popup the menus on the correct screen
If an item is split then its menu appears on the screen which contains most of it. Task-number: QTBUG-773 Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/widgets')
-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());