summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-06-06 09:08:33 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-09-26 07:49:16 +0000
commitf12d5b1d6108b4d285a6079655c58129451452fd (patch)
treec6dffcbe575f7d86f4da95e790a84f7ad671203c /src
parentb76c70173a1639876bd89b24ef59cfb7e07d83e2 (diff)
QMenuBar: Account for displays that are above 0x0
If a display is placed above a primary screen which has the top left set to be 0x0, then menus that are defaulting to go up can still be displayed on that screen when the menubar is placed on the bottom of it. This ensures that this is the case and also adds a manual test to aid verification of it in the future. Change-Id: Ib657ccdc1aabfe1586c72585c087ac80a6c632c2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 34d212cb02f168e59c2a5c8e95a12377a57bfb7e) Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qmenubar.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 6dfbb7c8a1..ea6283dbcf 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -324,7 +324,7 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst)
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 fitUp = (pos.y() - popup_size.height() >= screenRect.top());
const bool fitDown = (pos.y() + popup_size.height() <= screenRect.bottom());
const bool rtl = q->isRightToLeft();
const int actionWidth = adjustedActionRect.width();