<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Verifying the validity of window position from a previously saved position]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">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.</p>
<p dir="auto">regards<br />
Bogdan</p>
]]></description><link>https://forum.qt.io/topic/55484/verifying-the-validity-of-window-position-from-a-previously-saved-position</link><generator>RSS for Node</generator><lastBuildDate>Fri, 28 Aug 2026 22:10:44 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/55484.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 20 Jun 2015 10:30:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Verifying the validity of window position from a previously saved position on Sat, 20 Jun 2015 11:52:56 GMT]]></title><description><![CDATA[<p dir="auto">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.</p>
<pre><code class="language-cpp">QRect storedGeometry = ...

if(!QApplication::desktop()-&gt;geometry().contains(storedGeometry))
    storedGeometry =  ...//  adjust the stored geometry
</code></pre>
<p dir="auto"><code>contains()</code> also has an overload for <code>QPoint</code> if you don't have the whole <code>QRect</code>.</p>
]]></description><link>https://forum.qt.io/post/278909</link><guid isPermaLink="true">https://forum.qt.io/post/278909</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Sat, 20 Jun 2015 11:52:56 GMT</pubDate></item></channel></rss>