Verifying the validity of window position from a previously saved position
-
Hi
I am trying to check if the position previously saved of my window is valid for the available screen. My problem is that with 2 screens the saved position might have negative values. When I use a single screen, this position is no longer valid, but how can I verify the validity of the window position in a generic manner, when say multiple screens are available.
regards
Bogdan -
You can get the QRect representing the whole virtual (multi-monitor) space using QDesktopWidget and then check if your stored point or rectangle is contained in the available space e.g.
QRect storedGeometry = ... if(!QApplication::desktop()->geometry().contains(storedGeometry)) storedGeometry = ...// adjust the stored geometry
contains()
also has an overload forQPoint
if you don't have the wholeQRect
.