<?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[Dragging a frameless window across mixed DPI monitors]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have a frameless window that I would like to make draggable across screens with mixed DPI's.</p>
<p dir="auto">My initial approach was to implement something similar to <a href="https://forum.qt.io/topic/85543/frameless-window-with-dragging">https://forum.qt.io/topic/85543/frameless-window-with-dragging</a> which worked for simple drags between positions in the same screen but started to fail (the window began jumping around) when moving between screens of mixed DPI's. I am guessing this is due to the fact that Qt reports logical coordinates for mouse events, meaning there are discontinuities in the reported coordinates when moving the mouse between screens (which explains the jumping around).</p>
<p dir="auto">My second approach was to get both the mouse and window positions in native coordinates, calculate the window’s target position, and then convert it back to logical coordinates to avoid these gaps. Converting to native coordinates was straightforward: I scaled the window’s dimensions by the device pixel ratio (DPR) of its current screen and adjusted its top-left position accordingly.</p>
<p dir="auto">Converting back to logical coordinates was trickier. The shift could move the window to another screen, so I needed to know the destination screen’s DPR. However, I had no information about which screen the window would end up on, which made me get stuck as there doesn't seem to be anything in Qt's API that allows me to do this.</p>
<p dir="auto">With this in mind, I guess I have mainly two questions:</p>
<p dir="auto">1 - Given a QRect in native coordinates, is there a way to determine which screen it would be on, similar to Win32’s MonitorFromRect?<br />
2 -  Is there an alternative better way to do this (without using Native APIs)?</p>
]]></description><link>https://forum.qt.io/topic/165076/dragging-a-frameless-window-across-mixed-dpi-monitors</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 16:27:18 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/165076.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Sep 2026 16:37:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dragging a frameless window across mixed DPI monitors on Thu, 10 Sep 2026 10:54:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Thanks, I will check that out</p>
]]></description><link>https://forum.qt.io/post/840087</link><guid isPermaLink="true">https://forum.qt.io/post/840087</guid><dc:creator><![CDATA[vscfreire]]></dc:creator><pubDate>Thu, 10 Sep 2026 10:54:43 GMT</pubDate></item><item><title><![CDATA[Reply to Dragging a frameless window across mixed DPI monitors on Wed, 09 Sep 2026 17:44:29 GMT]]></title><description><![CDATA[<p dir="auto">Even though it's private you should take a look at qhighdpiscaling_p.h (QtGui) and maybe also in it's sources.</p>
]]></description><link>https://forum.qt.io/post/840076</link><guid isPermaLink="true">https://forum.qt.io/post/840076</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 09 Sep 2026 17:44:29 GMT</pubDate></item></channel></rss>