I have a 2 monitor setup, a laptop with a screen res of 1366x768 on the left, and a main external monitor with a res of 1680x1050 on the right.
In windows, the right monitor is setup as my main display.
On app start, QDesktopWidget::availableGeometry(-1) reports the correct size, if I then unplug the main monitor, availableGeometry(-1) correctly reports the correct size of the laptop screen.
If I then plug the external monitor back into the laptop, availableGeometry(-1) provides incorrect values.
Here is a chunk of log from the attached sample program which simple logs on signals from QDesktopWidget:
I would expect, after plugging the external monitor back in that availableGeometry(-1) returns QRect(0,0 1680x1010)
I see the same (incorrect) behavior when physically removing the laptop from a dock and re-attaching it.