diff --git a/contributing.md b/contributing.md index 6af7d7396..6eca626ef 100644 --- a/contributing.md +++ b/contributing.md @@ -55,6 +55,5 @@ Diagrams should be submitted in SVG format. Also for these there are a number of * Gradients are not supported. * Animations are not supported. * Patterns are not supported. -* The image gets rendered by Qt at a fixed resolution matching the viewport of your image, and then scaled to the resolution that the user needs to display it at. For better quality, the SVG's viewport needs to be very large. Several thousand units is usually fine even for high DPI screens. It is up to the discretion of the package maintainer to decide whether images are too big or not. A major factor in this decision is whether the image is any bigger than strictly necessary. \ No newline at end of file diff --git a/resources/qml/ArticleImages.qml b/resources/qml/ArticleImages.qml index 9f0cfd345..24af7bf24 100644 --- a/resources/qml/ArticleImages.qml +++ b/resources/qml/ArticleImages.qml @@ -79,8 +79,9 @@ GridLayout { id: thumbnail source: modelData.substring(0, modelData.indexOf("|")) fillMode: Image.PreserveAspectFit - mipmap: true anchors.fill: parent + sourceSize.width: width + sourceSize.height: height } Image { diff --git a/resources/qml/SettingsGuide.qml b/resources/qml/SettingsGuide.qml index c42741eca..c2165dee0 100644 --- a/resources/qml/SettingsGuide.qml +++ b/resources/qml/SettingsGuide.qml @@ -176,20 +176,33 @@ Window { } Rectangle { - width: zoom_image.paintedWidth - height: zoom_image.paintedHeight + width: zoom_image.visible ? zoom_image.paintedWidth : zoom_image_svg.paintedWidth + height: zoom_image.visible ? zoom_image.paintedHeight : zoom_image_svg.paintedWidth color: "white" //Always white regardless of theme, to serve as background to the image. anchors.centerIn: parent AnimatedImage { id: zoom_image - source: settingsGuideBase.zoomed_image + source: visible ? settingsGuideBase.zoomed_image : "" //Don't even try to render for SVG. anchors.centerIn: parent width: zoom_layer.width * 2 / 3 height: zoom_layer.height * 2 / 3 fillMode: Image.PreserveAspectFit mipmap: true onStatusChanged: playing = (status == AnimatedImage.Ready) + visible: settingsGuideBase.zoomed_image.split('.').pop() !== "svg" //Only for non-SVG. + } + + Image { //Special one for SVG that automatically adjusts sourceSize. sourceSize is not supported for AnimatedImage, and AnimatedImage doesn't support animated SVG anyway. + id: zoom_image_svg + source: visible ? settingsGuideBase.zoomed_image : "" //Don't even try to render for non-SVG. + anchors.centerIn: parent + width: zoom_image.width + height: zoom_image.height + fillMode: Image.PreserveAspectFit + sourceSize.width: width + sourceSize.height: height + visible: !zoom_image.visible //Only for SVG. } } }