summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-06-29 13:31:41 +0200
committerAndy Shaw <andy.shaw@qt.io>2018-07-10 15:24:16 +0000
commita832e3773a3cbc51c6cd54d50ccd37be66aa300a (patch)
tree26c7e0e5cab00d81990ca9da9a1a411c7a78c545 /src/widgets
parent50be124f169f26ba5c94515f520b018e7fbe7da4 (diff)
Show the toolbutton's menu in the right place on multiple screens
When a screen is positioned to be above another, then the toolbutton menu could be shown on the wrong screen if it was deemed to not fit below the button the same screen. This ensures that it shows it on the right screen when there is sufficient space to do so. Change-Id: Ia626b28f74c1931904ff5b30cca17e63914d3c79 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index c94c10574f..03950ef44b 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -756,14 +756,14 @@ void QToolButtonPrivate::popupTimerDone()
QSize sh = ((QToolButton*)(QMenu*)actualMenu)->receivers(SIGNAL(aboutToShow()))? QSize() : actualMenu->sizeHint();
if (horizontal) {
if (q->isRightToLeft()) {
- if (q->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height()) {
+ if (q->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.bottom()) {
p = q->mapToGlobal(rect.bottomRight());
} else {
p = q->mapToGlobal(rect.topRight() - QPoint(0, sh.height()));
}
p.rx() -= sh.width();
} else {
- if (q->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height()) {
+ if (q->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.bottom()) {
p = q->mapToGlobal(rect.bottomLeft());
} else {
p = q->mapToGlobal(rect.topLeft() - QPoint(0, sh.height()));