-
Bug
-
Resolution: Cannot Reproduce
-
P1: Critical
-
None
-
5.10.1
-
None
-
macOS 10.10 / 10.13
SVG Images are not displayed anymore in the Image component since Qt 5.10.1. I tried Qt 5.9.5 and Qt 5.10.0 and both display the svg correctly. Attached is a small demo project.
svgtest.pro:
QT += quick svg
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += qml.qrc \
images.qrc
main.cpp:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
main.qml:
import QtQuick 2.9
import QtQuick.Window 2.2
Window {
visible: true
width: 150
height: 150
title: qsTr("Hello World")
Rectangle {
id: mapButton
anchors.centerIn: parent
width: 30
height: 30
color: Qt.darker("white", 1.1)
border.color: "grey"
border.width: 1
opacity: 0.8
Image {
id: mapButtonImage
source: "qrc:/material/zoom_out_map"
anchors.centerIn: parent
sourceSize.width: parent.width - 6
smooth: true
}
}
}
images.qrc:
<RCC>
<qresource prefix="/material">
<file alias="zoom_out_map">ic_zoom_out_map_black_24px.svg</file>
</qresource>
</RCC>
qml.qrc:
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>