Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.6
-
None
Description
I had forgotten to add the .svg extension in iconSource()... of course I had no feedback of that because of https://bugreports.qt.io/browse/QTBUG-66127. existingImageFileForPath will loop through a list of supported file types and try each one with the path. So even if you forget the extension, if your image exists with a known extension, it will be found and successfully loaded.
The problem is that isScalableImageFormat is called without that extension, so it doesn't see the svg extension and considers it not scalable. That causes QQuickImageBasePrivate::updateDevicePixelRatio to set setDevicePixelRatio to false, and devicePixelRatio is never set to the higher DPR (2).
I'm not sure how this should be fixed, as it would in theory require the non-existent-file-extension lookup to be done twice if it can't be cached somehow, which seems really sub-optimal.
Anyway, we can easily avoid it by fixing iconSource().
To reproduce the issue, run the attached example (or any QML snippet with an Image that leaves out the extension for an SVG) on a display with a DPR > 1:
import QtQuick import QtQuick.Window Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Image { source: "file-icon-round" } }
Attachments
Issue Links
- resulted from
-
QTBUG-66127 Make Image element support detection of suitable extension
- Closed