blob: e268c5746b5d46ce1643ac96ff3c3de3b2886e3a (
plain)
1 From 777f2a1c1e7e1cd669cc152aaa5b99d68b8a1ccd Mon Sep 17 00:00:00 2001
2 From: Friedemann Kleint <Friedemann.Kleint@qt.io>
3 Date: Wed, 10 Jun 2020 11:26:00 +0200
4 Subject: Fix QToolButton menus showing on primary screens in multiscreen
5 setups
6
7 Calculate an initial position based on the current size hint
8 and pass it to QMenuPrivate::exec(), which does screen checks
9 based on it.
10
11 Amends a78d66743171557d79b16c08be775e3ac15bb4ef.
12
13 Fixes: QTBUG-84462
14 Task-number: QTBUG-78966
15 Change-Id: Icae8d2bc0fb50c4c853cfebaa2b2250fc06542e3
16 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
17 (cherry picked from commit ad532ce118b7052be3b69999cef2eb610e66fa88)
18 Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
19 ---
20 src/widgets/widgets/qtoolbutton.cpp | 3 ++-
21 1 file changed, 2 insertions(+), 1 deletion(-)
22
23 diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
24 index 314c6ab40c..e380cb647b 100644
25 --- a/src/widgets/widgets/qtoolbutton.cpp
26 +++ b/src/widgets/widgets/qtoolbutton.cpp
27 @@ -805,7 +805,8 @@ void QToolButtonPrivate::popupTimerDone()
28 // QTBUG-78966, Delay positioning until after aboutToShow().
29 auto positionFunction = [q, horizontal](const QSize &sizeHint) {
30 return positionMenu(q, horizontal, sizeHint); };
31 - actualMenu->d_func()->exec({}, nullptr, positionFunction);
32 + const auto initialPos = positionFunction(actualMenu->sizeHint());
33 + actualMenu->d_func()->exec(initialPos, nullptr, positionFunction);
34
35 if (!that)
36 return;
37 --
38 cgit v1.2.1
|