qt5base-lts/tests/manual/qscreen
Shawn Rutledge 3c08035b7b QScreen manual test: add MouseMonitor to test multi-screen scenarios
- QMouseEvent::screenPos() should be global desktop position
- QDesktopWidget::screenNumber() should tell the correct screen
- QGuiApplication::topLevelAt(screenPos) should find the window where
  the mouse is clicked

Change-Id: I9a63ab3ee1944b7246551d0f3d5e37f0d2aa5457
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-04-08 14:49:59 +00:00
..
main.cpp QScreen manual test: add MouseMonitor to test multi-screen scenarios 2016-04-08 14:49:59 +00:00
propertyfield.cpp Update copyright headers 2015-02-11 06:49:51 +00:00
propertyfield.h Update copyright headers 2015-02-11 06:49:51 +00:00
propertywatcher.cpp Manual QScreen test: capture screen changes. 2015-05-07 13:04:41 +00:00
propertywatcher.h Manual QScreen test: capture screen changes. 2015-05-07 13:04:41 +00:00
qscreen.pro Manual QScreen test: capture screen changes. 2015-05-07 13:04:41 +00:00
README Fix the qscreen manual test for separate X screens 2015-05-12 08:58:52 +00:00

To test whether QScreen properties are updated properly when the screen
actually changes, you will need to run some kind of control panel to make
changes, and this test program at the same time. E.g. on Linux, you can use
xrandr with various parameters on the command line, but there is also a nice
GUI called arandr which will probably work on any distro. Real-world users
would probably use the Gnome or KDE control panels, so that's also a good way
to test. On OSX you can make changes in System Preferences | Displays, and you
can also configure it to put a "monitors" icon on the menubar with a drop-down
menu for convenience. On Windows you can right-click on the desktop to get
display settings.

Note that on Linux, if you have one graphics card with two outputs, typically
the two monitors connected to the outputs are combined into a single virtual
"screen", but each screen has multiple outputs. In that case there will be a
unique QScreen for each output, and they will be virtual siblings. The virtual
geometry depends on how you arrange the monitors (second one is to the right,
or above the first one, for example). It should be about the same if you are
using two graphics cards but using Xinerama to combine them. This test app will
create two windows, and will center one each screen, by setting the geometry.

Alternatively you can configure xorg.conf to create separate screens for each
graphics card; then the mouse cursor can move between the screens, but
application windows cannot: each app needs to be started on the screen that
you want to run it on (by specifying e.g. DISPLAY=:0.1 for the second screen),
or the application has to set the desired screen via QWindow::setScreen() before
showing the window.

The physical size of the screen is considered to be a constant. This can create
discrepancies in DPI when orientation is changed, or when the screen is
actually a VNC server and you change the resolution. So maybe
QScreen::physicalSize should also have a notifier, but that doesn't physically
make sense except when the screen is virtual.

Another case is running two separate X servers on two graphics cards. In that
case they really do not know about each other, even at the xlib/xcb level, so
this test is irrelevant. You can run the test independently on each X server,
but you will just get one QScreen instance on each.