diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-06-17 17:47:30 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-06-21 11:43:46 +0200 |
commit | 82da8306bc1313b85632eee0faf858239261a092 (patch) | |
tree | efdd072828cca98aa0b4133623005c8d1e9c4390 /tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | |
parent | 121692e5408561f486cad5cd170ac8bcd2557eb2 (diff) |
Deal with multi-display scenarios when positioning menu popups
This is to support rare setups involving an X11 server with multiple
independent displays ("zaphod heads" on which the DISPLAY env var
is different), possibly with multiple outputs forming a virtual desktop
on each display.
QMenu::popup() has been assuming that it should show on the screen where
the mouse cursor is. That's good most of the time; but with multiple
independent screens, QGuiApplication::screenAt(pos) cannot tell us which
screen to use (it's ambiguous), but rather will choose the first screen
that _could_ contain that position (as documented). In the example in
QTBUG-76162, the QMenu has been constructed with a QDesktopScreenWidget
as its parent specifically for the purpose of telling it which screen to
pop up on; so we need to respect that. But QWidgetPrivate::init() sets
the QObject::parent() to null (because the widget isn't actually shown
as a child of the QDesktopScreenWidget), and QWidgetPrivate::create_sys()
sets initialScreenIndex back to -1 to provide freedom to change the
screen later; so QMenu has to remember the screen index for itself.
QMenuBarPrivate::popupAction() searches the siblings of the screen on
which the menubar is claiming to be (rather than all screens on all
displays), to find the screen containing the point at the middle of the
bottom edge of the clicked menubar item. It then sets initialScreenIndex
so that QMenu::popup() will respect it rather than trying to decide for
itself.
Fixes: QTBUG-76162
Change-Id: I7a8f8e7aa2e9cf5340d446dc12726369ebe2589a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp')
0 files changed, 0 insertions, 0 deletions