fix(StatusIcon): flag/currency icons are rendered blurred

- set the Image's sourceSize only if it's an SVG, otherwise it is
rendered blurry
- remove antialiasing/mipmap; it's not the correct fix, doesn't really
improve the visual quality for smallish items like icons and just causes
memory/GPU overhead
This commit is contained in:
Lukáš Tinkl 2022-07-06 11:31:05 +02:00 committed by Michał Cieślak
parent 9a076ee49c
commit dd38cfc0de
1 changed files with 3 additions and 7 deletions

View File

@ -8,23 +8,19 @@ Image {
id: statusIcon id: statusIcon
width: 24 width: 24
height: 24 height: 24
sourceSize.width: width // SVGs must have sourceSize, PNGs not; otherwise blurry
sourceSize.height: height sourceSize: !!icon ? Qt.size(width, height) : undefined
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
antialiasing: true
mipmap: true
onIconChanged: { onIconChanged: {
if (icon !== "") { if (icon !== "") {
source = "../../assets/img/icons/" + icon + ".svg"; source = "../../assets/img/icons/" + icon + ".svg";
} }
} }
layer.mipmap: true
layer.smooth: true layer.smooth: true
layer.format: ShaderEffectSource.RGBA layer.format: ShaderEffectSource.RGBA
layer.enabled:!Qt.colorEqual(statusIcon.color, "transparent") layer.enabled: !Qt.colorEqual(statusIcon.color, "transparent")
layer.effect: ColorOverlay { layer.effect: ColorOverlay {
color: statusIcon.color color: statusIcon.color
} }