<?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[QML HighDPI scaling problem on Windows 11]]></title><description><![CDATA[<p dir="auto">Some lines (like scrollbars) looks broken on HighDPI.<br />
Windows 11 26H2, Qt 6.12.0 built from sources with MinGW-w64 (g++ version 16.2.0), 4k monitor, scaling 150%.<br />
AMD Ryzen 5 5600, NVidia GeForce GTX 1660 Super (driver v617.14).<br />
Minimal Reproducible Example (main.qml):</p>
<pre><code>import QtQuick
import QtQuick.Controls

Window {
    width: 343 // odd value
    height: 100
    visible: true
    title: "DPR 1.5 Subpixel Artifact Test"

    Rectangle {
        anchors.fill: parent
        color: "#f0f0f0"

        ScrollView {
            anchors.fill: parent
            TextArea {
                text: "Resize the window horizontally pixel by pixel to observe the 1px line / scrollbar shifting and thickening to 2px."
            }
        }
    }
}
</code></pre>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/a5f0dab5-d1f0-4f66-9762-ce383db634c2.png" alt="QML_06.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Font dialog from examples\quickcontrols\texteditor:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/b0e784b4-7631-4b4b-9d0f-68128ebe9648.png" alt="QML_02.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Could you please tell me what might be causing this behavior? How can it be fixed?<br />
Tried, but it didn't help:</p>
<ul>
<li>set QT_SCALE_FACTOR_ROUNDING_POLICY=Round</li>
<li>set QSG_RHI_BACKEND=opengl</li>
<li>set QSG_RHI_BACKEND=d3d11</li>
<li>set QSG_RHI_BACKEND=software</li>
<li>set QML_USE_GLYPH_CACHE_WORKAROUND=1</li>
<li>set QT_ENABLE_REGULAR_EXPRESSION_OPTION_WIN=1</li>
<li>set QSG_RENDER_LOOP=basic</li>
<li>set QT_QPA_PLATFORM=windows:dpiawareness=1</li>
<li>set QT_QPA_PLATFORM=windows:fontengine=freetypedirectwrite</li>
<li>set QML_XHR_ALLOW_FILE_READ=1</li>
</ul>
]]></description><link>https://forum.qt.io/topic/165144/qml-highdpi-scaling-problem-on-windows-11</link><generator>RSS for Node</generator><lastBuildDate>Tue, 27 Oct 2026 10:27:01 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/165144.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 04 Oct 2026 14:04:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QML HighDPI scaling problem on Windows 11 on Mon, 12 Oct 2026 18:44:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/axel-spoerl">@<bdi>Axel-Spoerl</bdi></a><br />
Sorry. It looks like the black rectangle isn't a regression, but rather the implementation of dark mode support. In version 6.8, dark mode wasn't applied automatically. If the system color theme is light, both versions look identical.<br />
Qt 6.8.3, Dark theme, scale 100%:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/71a73ecd-1d25-45ed-8f99-4f2ec5c51524.png" alt="QML_08.png" class=" img-fluid img-markdown" /><br />
Qt 6.12.0, Light theme, scale 100%:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/8b33cb68-132d-4875-abc8-16958c5d9507.png" alt="QML_6.12_light.png" class=" img-fluid img-markdown" /><br />
Interestingly, even at 100% scale, the scrollbar looks a bit jagged in both versions, even though the scrollbar itself is straight.</p>
<p dir="auto">However, Fusion.ScrollBar looks good. Thank You.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/31dff5ec-b1ac-45f7-a7c0-780738a887fd.png" alt="QML_fusion.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Should I close the topic as resolved?</p>
]]></description><link>https://forum.qt.io/post/840462</link><guid isPermaLink="true">https://forum.qt.io/post/840462</guid><dc:creator><![CDATA[Yuri]]></dc:creator><pubDate>Mon, 12 Oct 2026 18:44:54 GMT</pubDate></item><item><title><![CDATA[Reply to QML HighDPI scaling problem on Windows 11 on Sun, 11 Oct 2026 15:48:05 GMT]]></title><description><![CDATA[<p dir="auto">Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/yuri">@<bdi>Yuri</bdi></a>, that confirms it. At a device pixel ratio of 2, every logical pixel is exactly two physical pixels, so nothing can land on half a pixel and the artifacts disappear. At 1.5 they're a consequence of fractional scaling rather than a bug in Qt Quick. So you can choose between QT_SCALE_FACTOR_ROUNDING_POLICY=Round (crisp, but a 200% UI) and staying at 150% with these unpleasant effects.</p>
<p dir="auto">Sorry about the warnings, those are my fault. I said earlier that your scrollbars come from FluentWinUI3/Fusion, but on Windows the default is the native Windows style, and it can't be customized. That causes both messages, including the Unable to assign [undefined] to int on resize. Basing the custom scrollbar on Fusion's ScrollBar fixes it. Only these two lines change:</p>
<pre><code>import QtQuick.Controls.Fusion as Fusion 

component FlatScrollBar: Fusion.ScrollBar {
</code></pre>
<p dir="auto">Fusion is only used for this one component. All other controls keep the Windows style.</p>
<p dir="auto">About the black rectangle on the scrollbar in 6.12 that isn't there in 6.8: if it shows up at 100% scaling too, or with Round, it looks like a regression. Could you file a bug report at <a href="https://bugreports.qt.io" target="_blank" rel="noopener noreferrer nofollow ugc">https://bugreports.qt.io</a> with your example and both screenshots (6.8 and 6.12)? Please post the link here so others can follow it.</p>
]]></description><link>https://forum.qt.io/post/840438</link><guid isPermaLink="true">https://forum.qt.io/post/840438</guid><dc:creator><![CDATA[Axel Spoerl]]></dc:creator><pubDate>Sun, 11 Oct 2026 15:48:05 GMT</pubDate></item><item><title><![CDATA[Reply to QML HighDPI scaling problem on Windows 11 on Sun, 11 Oct 2026 13:52:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/axel-spoerl">@<bdi>Axel-Spoerl</bdi></a><br />
Your code runs with some warnings:</p>
<pre><code>qml test.qml
file:///C:/Qt/6.12.0/mingw64_162/bin/test.qml:12:24: QML QQuickRectangle: The current style does not support customization of this control (property: "contentItem" item: QQuickRectangle(0x21868a6e230, parent=0x0, geometry=0,0 4x4)). Please customize a non-native style (such as Basic, Fusion, Material, etc). For more information, see: https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference
file:///C:/Qt/6.12.0/mingw64_162/bin/test.qml:12:24: QML QQuickRectangle: The current style does not support customization of this control (property: "contentItem" item: QQuickRectangle(0x21868a6d6f0, parent=0x0, geometry=0,0 4x4)). Please customize a non-native style (such as Basic, Fusion, Material, etc). For more information, see: https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference
qml: 2
</code></pre>
<p dir="auto">But with QT_SCALE_FACTOR_ROUNDING_POLICY=Round the problem is gone.<br />
Qt 6.12.0 MinGW:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/37653cde-1ab4-450b-a388-ba9985d2a1e1.png" alt="QML_scale.png" class=" img-fluid img-markdown" /><br />
Qt 6.8.3 MSVC:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/93b0eaf5-1057-4329-a9e3-3901e0f48c1a.png" alt="QML_6.8.3_msvc_scale.png" class=" img-fluid img-markdown" /><br />
Also on every resizing it prints this message:</p>
<pre><code>qrc:/qt-project.org/imports/QtQuick/Controls/Windows/ScrollBar.qml:37:49: Unable to assign [undefined] to int
</code></pre>
<p dir="auto">I also see that in Qt 6.12 a black rectangle is drawn on the scrollbar, which is not present in Qt 6.8. But this problem is not related to this topic.</p>
]]></description><link>https://forum.qt.io/post/840435</link><guid isPermaLink="true">https://forum.qt.io/post/840435</guid><dc:creator><![CDATA[Yuri]]></dc:creator><pubDate>Sun, 11 Oct 2026 13:52:56 GMT</pubDate></item><item><title><![CDATA[Reply to QML HighDPI scaling problem on Windows 11 on Sun, 11 Oct 2026 12:17:40 GMT]]></title><description><![CDATA[<p dir="auto">Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/yuri">@<bdi>Yuri</bdi></a>, that's very helpful.<br />
Your tests rule out the compiler, the graphics backend (it even happens with software) and a recent regression.<br />
What's left is how geometry maps to device pixels at a fractional scale factor.</p>
<p dir="auto">At 150%, one logical pixel is 1.5 physical pixels. Anything at an odd logical coordinate lands on half a physical pixel. Qt Quick doesn't snap item geometry to physical pixels, so a 1px line covers sometimes one and sometimes two physical pixels. If it's antialiased, it gets smeared across an extra pixel.</p>
<p dir="auto">The scrollbars show this most. With the default style on Windows 11 (FluentWinUI3), the ScrollBar comes from Fusion: a thin, rounded and therefore antialiased handle. It changes while you resize because the window's logical size is a whole number but its physical size isn't always divisible by 1.5. For example, 515 physical pixels is 343.33 logical, but the window reports 343. Items attached to the right or bottom edge, like the scrollbars, end up half a physical pixel off in one direction or the other. Which way depends on the window width, so it flips with every pixel you resize.</p>
<p dir="auto">I wrote earlier that the rounding policy should prevent this. I have to correct myself here. It's only true if it actually takes effect. With QT_SCALE_FACTOR_ROUNDING_POLICY=Round, 1.5 becomes 2, and at 2 the artifacts should disappear. Your log shows qml: 1.5, though. Could you set the variable in the same shell you start the app from and check what Screen.devicePixelRatio prints?</p>
<ul>
<li>If it prints 2 and the artifacts are still there, that's a bug and worth a report.</li>
<li>If it still prints 1.5, the variable isn't reaching the application.</li>
</ul>
<p dir="auto">You can solve the problem by either bumping the scale factor to 2. That should solve everything, if 2 is acceptable.<br />
Otherwise you can use a custom scrollbar, that is more forgiving. I experimented a bit:</p>
<pre><code>import QtQuick
  import QtQuick.Controls
  
  Window {
      width: 343
      height: 100
      visible: true
      title: "DPR 1.5 Subpixel Artifact Test"
      
      component FlatScrollBar: ScrollBar {
          id: bar
          contentItem: Rectangle {
              implicitWidth: 4    // 4 logical = 6 physical pixels at 150%
              implicitHeight: 4   
              antialiasing: false 
              color: bar.pressed ? bar.palette.dark : bar.palette.mid
              opacity: 0.0
              
              states: State {
                  name: "active"
                  when: bar.policy === ScrollBar.AlwaysOn || (bar.active &amp;&amp; bar.size &lt; 1.0)
                  PropertyChanges { bar.contentItem.opacity: 0.75 }
              }   
              
              transitions: Transition {
                  from: "active"
                  SequentialAnimation {
                      PauseAnimation { duration: 450 }
                      NumberAnimation { target: bar.contentItem; duration: 200; property: "opacity"; to: 0.0 }
                  }   
              }   
          }   
      }   
      
      Rectangle {
          anchors.fill: parent
          color: "#f0f0f0"
          
          ScrollView {
              id: scrollView
              anchors.fill: parent
              
              ScrollBar.horizontal: FlatScrollBar {
                  parent: scrollView
                  x: scrollView.leftPadding
                  y: scrollView.height - height
                  width: scrollView.availableWidth
                  active: scrollView.ScrollBar.vertical.active
              }   
              
              ScrollBar.vertical: FlatScrollBar {
                  parent: scrollView
                  x: scrollView.mirrored ? 0 : scrollView.width - width
                  y: scrollView.topPadding 
                  height: scrollView.availableHeight
                  active: scrollView.ScrollBar.horizontal.active
              }   
              
              TextArea {
                  text: "Resize the window horizontally pixel by pixel to observe the 1px line / scrollbar shifting and thickening to 2px."
              }   
          }   
      }   
  }   
</code></pre>
]]></description><link>https://forum.qt.io/post/840431</link><guid isPermaLink="true">https://forum.qt.io/post/840431</guid><dc:creator><![CDATA[Axel Spoerl]]></dc:creator><pubDate>Sun, 11 Oct 2026 12:17:40 GMT</pubDate></item><item><title><![CDATA[Reply to QML HighDPI scaling problem on Windows 11 on Sun, 11 Oct 2026 11:50:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/axel-spoerl">@<bdi>Axel-Spoerl</bdi></a><br />
Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/axel-spoerl">@<bdi>Axel-Spoerl</bdi></a>.<br />
The same code on Qt 6.8.3 MSVC 2022 has the same problem. But colors are differs from Qt 6.12.0 version.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/a3300875-eba4-45a0-959a-fcf420864b50.png" alt="QML_6.8.3_msvc2022.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">On Qt 6.8.3 MinGW 15.2 it starts with errors:<br />
qml: 1.5<br />
Failed to create swapchain. Retrying by requesting a software rasterizer, if applicable for the 3D API implementation.<br />
Failed to build or resize swapchain<br />
Failed to present: IDXGISwapChain is unavailable<br />
Failed to end frame<br />
<img src="https://ddgobkiprc33d.cloudfront.net/443ec6e4-b6c2-4671-bc1a-e5eebc8c4fbb.png" alt="368b30b0-95f1-41e4-9dd7-798b74f1f19f-image.png" class=" img-fluid img-markdown" /><br />
If backend is OpenGL (set QSG_RHI_BACKEND=opengl) then window with any size starts without this problem, but the problem returns on window resizing.<br />
Identical behavior on any Qt and compiler version.<br />
Qt 6.8.3 (MSVC and MinGW):<br />
<img src="https://ddgobkiprc33d.cloudfront.net/1774cec1-926c-4b61-a720-c1e16ee5c6b4.png" alt="QML_6.8.3_msvc2022_opengl_2.png" class=" img-fluid img-markdown" /><br />
Qt 6.12.0 MinGW:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/8c2d7973-a387-41ee-8aa4-f1b52980f56e.png" alt="QML_opengl_1.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/840430</link><guid isPermaLink="true">https://forum.qt.io/post/840430</guid><dc:creator><![CDATA[Yuri]]></dc:creator><pubDate>Sun, 11 Oct 2026 11:50:12 GMT</pubDate></item><item><title><![CDATA[Reply to QML HighDPI scaling problem on Windows 11 on Sun, 11 Oct 2026 08:39:11 GMT]]></title><description><![CDATA[<p dir="auto">Okay, thanks @Yuri.<br />
What you see is technically a consequence of alternating rounding decisions. Since you have set a rounding policy, this should not happen.</p>
<p dir="auto">Can you do me two more favors please:</p>
<ul>
<li>It's unlikely that the problem sits with MinGW. To exclude it completely, could you try MSVC instead?</li>
<li>To see whether it's a regression, could you try an older Qt build, preferably 6.8?</li>
</ul>
]]></description><link>https://forum.qt.io/post/840428</link><guid isPermaLink="true">https://forum.qt.io/post/840428</guid><dc:creator><![CDATA[Axel Spoerl]]></dc:creator><pubDate>Sun, 11 Oct 2026 08:39:11 GMT</pubDate></item><item><title><![CDATA[Reply to QML HighDPI scaling problem on Windows 11 on Sat, 10 Oct 2026 22:31:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/axel-spoerl">@<bdi>Axel-Spoerl</bdi></a><br />
qml: 1.5</p>
]]></description><link>https://forum.qt.io/post/840424</link><guid isPermaLink="true">https://forum.qt.io/post/840424</guid><dc:creator><![CDATA[Yuri]]></dc:creator><pubDate>Sat, 10 Oct 2026 22:31:12 GMT</pubDate></item><item><title><![CDATA[Reply to QML HighDPI scaling problem on Windows 11 on Sat, 10 Oct 2026 11:12:36 GMT]]></title><description><![CDATA[<p dir="auto">If you add</p>
<pre><code>Component.onCompleted:
    console.log(Screen.devicePixelRatio)
</code></pre>
<p dir="auto">What's the output?</p>
]]></description><link>https://forum.qt.io/post/840418</link><guid isPermaLink="true">https://forum.qt.io/post/840418</guid><dc:creator><![CDATA[Axel Spoerl]]></dc:creator><pubDate>Sat, 10 Oct 2026 11:12:36 GMT</pubDate></item></channel></rss>