<?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[[Qt Widgets] Widget far too large, fonts OK ?]]></title><description><![CDATA[<p dir="auto">Hi there,</p>
<p dir="auto">We are currently reinstalling our apps on a new Real-Time Linux-based machine, based on CentOS 8.3, with Qt5.9.9 (built from sources). We are running into a strange but critical bug tied to Qt Widget.</p>
<p dir="auto">With one (and only one) of our app :</p>
<ul>
<li><strong>all the widgets and windows are very big on screen (like 3 to 4 times bigger than they should be).</strong> Cf the screen capture below</li>
<li>still, the fonts are displayed with the correct size.</li>
</ul>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/f0f48d85-1901-49b3-a0d7-d718b1a8088a.png" alt="capture_G4.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Still, the Qt installation is OK : examples run fine ;  and <strong>the widget size problem does not occur with any of our other apps</strong> (compiled and linked with the exact same options and libraries, and run with the same dynamic libraries).<br />
Finally, the failing app (same exact source code) compiles and runs OK on Ubuntu, Mac and Windows with also Qt5.9.9.</p>
<p dir="auto">Hence, the problem only occurs on our "special" real time Linux, and only with this specific app.</p>
<p dir="auto">I suspect this is a weird bug in our code, that is only revealed on this specific OS/Qt distribution. It may be due to a bad QPainter::scale(...) ; save() or restore()... Or something else approaching... I may be totally wrong though.</p>
<p dir="auto">We have browsed quite extensively our code and compilation options, with no success so far.</p>
<p dir="auto"><strong>Perhaps someone may have a hint for us ? Eg where we may give another look in our code...</strong> That would be a-we-some :)</p>
<p dir="auto">Thank you very much !<br />
Nicolas</p>
]]></description><link>https://forum.qt.io/topic/127022/qt-widgets-widget-far-too-large-fonts-ok</link><generator>RSS for Node</generator><lastBuildDate>Mon, 19 Oct 2026 19:49:17 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/127022.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 May 2021 15:09:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Qt Widgets] Widget far too large, fonts OK ? on Mon, 31 May 2021 14:41:47 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
Ok that was lucky. :)</p>
<blockquote>
<p dir="auto">I am  wondering why it conversely triggers a resolution issue on our cent-os-based real time OS (without high DPI screen) !</p>
</blockquote>
<p dir="auto">Me too as I not seen it does such strange stuff across operating systems.</p>
<blockquote>
<p dir="auto">=&gt; In case you want me to investigate in this, how should we proceed ? SHould we look into some system configuration files ?</p>
</blockquote>
<p dir="auto">Well I would start with logging the values from<br />
<a href="https://doc.qt.io/qt-5/qscreen.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qscreen.html</a><br />
looking values like<br />
<a href="https://doc.qt.io/qt-5/qscreen.html#devicePixelRatio-prop" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qscreen.html#devicePixelRatio-prop</a><br />
as docs says<br />
"The Qt::AA_EnableHighDpiScaling application attribute, introduced in Qt 5.6, enables automatic scaling based on the monitor's pixel density."<br />
So i guess it somehow got some odd values on this linux Os.<br />
So i would be lazy and reuse some code like<br />
<a href="https://www.ics.com/blog/whats-new-qt-5-qscreen-class" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.ics.com/blog/whats-new-qt-5-qscreen-class</a><br />
and then compare the values between the issues Os and a working one.</p>
<blockquote>
<p dir="auto">Finally, I guess I have to update the way our app manages high/standard DPI screens issues, in our multiplatform context.<br />
We used to enable Qt::AA_EnableHighDpiScaling with Qt5.6 quite a long time ago.<br />
=&gt; But in fact, today, we should NOT enable Qt::AA_EnableHighDpiScaling, should we ?</p>
</blockquote>
<p dir="auto">Well normally it's quite ok to leave it ON as the scaling normally only kicks in when it is in fact a hires screen.<br />
You should check what value QT_SCALE_FACTOR gets as that has a huge effect of the size of the widgets.<br />
docs states: "Note: Non-integer scale factors may cause significant scaling/painting artifacts."<br />
so i do wonder if that is our first real life example :)</p>
<p dir="auto">you are welcome :)</p>
]]></description><link>https://forum.qt.io/post/662607</link><guid isPermaLink="true">https://forum.qt.io/post/662607</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Mon, 31 May 2021 14:41:47 GMT</pubDate></item><item><title><![CDATA[Reply to [Qt Widgets] Widget far too large, fonts OK ? on Mon, 31 May 2021 13:34:44 GMT]]></title><description><![CDATA[<p dir="auto">Hi all, hi mrjj,</p>
<p dir="auto">thanks for your answers and help.</p>
<p dir="auto">In fact, the bug was related  an application-wide high dpi scaling setting.</p>
<p dir="auto">Our main() called</p>
<pre><code>QCoreApplication::setAttribute( Qt::AA_EnableHighDpiScaling, true)
</code></pre>
<p dir="auto">Commenting this line solves the issue on our Linux.</p>
<p dir="auto">This call is OK on almost all our Linux machines (with and without high DPI screens).<br />
I am  wondering why it conversely triggers a resolution issue on our cent-os-based real time OS (without high DPI screen) !</p>
<p dir="auto">=&gt; In case you want me to investigate in this, how should we proceed ? SHould we look into some system configuration files ?</p>
<p dir="auto">Finally, I guess I have to update the way our app manages high/standard DPI screens issues, in our multiplatform context.<br />
We used to enable Qt::AA_EnableHighDpiScaling with Qt5.6 quite a long time ago.</p>
<p dir="auto">=&gt; But in fact, today, we should NOT enable Qt::AA_EnableHighDpiScaling, should we ?</p>
<p dir="auto">Thanks again.<br />
Issue solved !<br />
Nicolas</p>
]]></description><link>https://forum.qt.io/post/662596</link><guid isPermaLink="true">https://forum.qt.io/post/662596</guid><dc:creator><![CDATA[NicolasC]]></dc:creator><pubDate>Mon, 31 May 2021 13:34:44 GMT</pubDate></item><item><title><![CDATA[Reply to [Qt Widgets] Widget far too large, fonts OK ? on Wed, 26 May 2021 16:30:44 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
That is new.  :)</p>
<p dir="auto">I would check:</p>
<ul>
<li>
<p dir="auto">the use of stylesheets (if any)</p>
</li>
<li>
<p dir="auto">try run app with scaling disabled<br />
<a href="https://doc.qt.io/qt-5/highdpi.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/highdpi.html</a></p>
</li>
<li>
<p dir="auto">add a new form to the project and place one widget on it<br />
and see if that suffer the same even if "fresh"</p>
</li>
</ul>
]]></description><link>https://forum.qt.io/post/661744</link><guid isPermaLink="true">https://forum.qt.io/post/661744</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 26 May 2021 16:30:44 GMT</pubDate></item></channel></rss>