From a832e3773a3cbc51c6cd54d50ccd37be66aa300a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 29 Jun 2018 13:31:41 +0200 Subject: 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 Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qtoolbutton.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets') 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())); -- cgit v1.2.3