-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8
-
None
When using `QQuickImageProvider` to provide resources for `BorderImage`, there is an issue with how it handles window scaling. If the screen's scaling factor is dynamically adjusted at runtime, `BorderImage` will use the window's `devicePixelRatio` as the `devicePixelRatio` for the image resource, which is incorrect. This issue can be resolved by forcing the image resource to reload—for example, by setting the `source` property to an empty string and then restoring it to its original value. This will reset the image resource's `devicePixelRatio` to 1.0, which is the correct value. Alternatively, restarting the application after changing the screen's scaling factor can also solve the problem.
When loading image resources directly using `qrc` file paths, the issue does not occur, and the image resource's `devicePixelRatio` is always 1.0.
I have only tested `BorderImage`, but since the behavior of setting `devicePixelRatio` occurs in `QQuickImageBase`, I am unsure if `Image` or `AnimatedImage` have the same issue.
In various `Image` components in QML, scaling-related issues are commonly encountered when attempting to display image resources correctly under screen scaling factors greater than 1.0 (in HiDPI scenarios). However, the `devicePixelRatio` of the image resource is not exposed as a property in `Image`. Instead, it is automatically calculated in `QQuickImageBase` and related `QQuickPixmap` image-loading processes. The Qt code even includes checks for whether the image format is SVG or PDF, but I believe this is not a good design. Such decisions should be left to the developers.
I marked the reproduction platform as Linux/Wayland because it is the only testing environment I have. However, based on the nature of this bug, it should occur on any platform. It's just that users rarely change the screen's scaling factor at runtime.
The reproduction steps are straightforward: in any Wayland environment, first set the screen scaling factor to 1.0 and then launch the test application. Next, change the screen's scaling factor to 2.0, and the bug should appear.
- resulted from
-
QTBUG-94622 svg Image is Pixelated when windows is scaled
-
- Closed
-
For Gerrit Dashboard: QTBUG-131472 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
605293,3 | QQuickBorderImage: Border scaling on HiDPI displays is incorrect | dev | qt/qtdeclarative | Status: NEW | 0 | 0 |
607320,3 | QQuickImageBase: DPR in QQuickImageBase is not updated | dev | qt/qtdeclarative | Status: NEW | 0 | 0 |