Qt 6.11 is out! See what's new in the release
blog
Verifying the validity of window position from a previously saved position
General and Desktop
2
Posts
2
Posters
973
Views
2
Watching
-
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 geometrycontains()also has an overload forQPointif you don't have the wholeQRect.