Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-67942

SVG Image not displayed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: 5.10.1
    • Fix Version/s: None
    • Component/s: Quick: Other, SVG Support
    • Labels:
      None
    • Environment:
      macOS 10.10 / 10.13

      Description

      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>
      
      

        Attachments

        1. bug_5.10.1.png
          bug_5.10.1.png
          15 kB
        2. correct.png
          correct.png
          16 kB
        3. ic_zoom_out_map_black_24px.svg
          2 kB
        4. images.qrc
          0.1 kB
        5. main.cpp
          0.4 kB
        6. main.qml
          0.5 kB
        7. qml.qrc
          0.1 kB
        8. qtbug67942.zip
          5 kB
        9. svgtest.pro
          0.1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              w00t Robin Burchell
              Reporter:
              adrian2k Adrian Jäkel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes