1 To test whether QScreen properties are updated properly when the screen
2 actually changes, you will need to run some kind of control panel to make
3 changes, and this test program at the same time. E.g. on Linux, you can use
4 xrandr with various parameters on the command line, but there is also a nice
5 GUI called arandr which will probably work on any distro. Real-world users
6 would probably use the Gnome or KDE control panels, so that's also a good way
7 to test. On OSX you can make changes in System Preferences | Displays, and you
8 can also configure it to put a "monitors" icon on the menubar with a drop-down
9 menu for convenience. On Windows you can right-click on the desktop to get
12 Note that on Linux, if you have one graphics card with two outputs, typically
13 the two monitors connected to the outputs are combined into a single virtual
14 "screen", but each screen has multiple outputs. In that case there will be a
15 unique QScreen for each output, and they will be virtual siblings. The virtual
16 geometry depends on how you arrange the monitors (second one is to the right,
17 or above the first one, for example). It should be about the same if you are
18 using two graphics cards but using Xinerama to combine them. This test app will
19 create two windows, and will center one each screen, by setting the geometry.
21 Alternatively you can configure xorg.conf to create separate screens for each
22 graphics card; then the mouse cursor can move between the screens, but
23 application windows cannot: each app needs to be started up on the screen that
24 you want to run it on. In either case, ideally this test app ought to create
25 two windows, one on each screen; but in fact, it can do that only if the
26 screens are virtual siblings. If they are on different Displays, the second
27 Display is not accessible to the QXcbConnection instance which was createad on
28 the first Display. It can be considered a known bug that the API appears to
29 make this possible (you would think QWindow::setScreen might work) but it
32 The physical size of the screen is considered to be a constant. This can create
33 discrepancies in DPI when orientation is changed, or when the screen is
34 actually a VNC server and you change the resolution. So maybe
35 QScreen::physicalSize should also have a notifier, but that doesn't physically
36 make sense except when the screen is virtual.
38 Another case is running two separate X servers on two graphics cards. In that
39 case they really do not know about each other, even at the xlib/xcb level, so
40 this test is irrelevant. You can run the test independently on each X server,
41 but you will just get one QScreen instance on each.