Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Error while trying to use svg image
Qt 6.11 is out! See what's new in the release blog

Error while trying to use svg image

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 615 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adnan_14
    wrote on last edited by
    #1

    Hi,

    We are using qt6.9.1 on windows.
    We are trying to use svg image in our project but we get below error:-

    error: qt.svg: <use> element image0_2845_461 in wrong context!
    

    This is my qml code where i am trying to include the svg file

            Image {
                id: name
                source: "cctv_camera.svg"
                anchors.fill: parent
                fillMode: Image.PreserveAspectFit
            }
    

    Note: We are using SVGs because when the application is scaled, PNG images appear blurry.

    I saw Qt only supports the SVG Tiny format. Is there a way to convert my existing SVGs to this format, or is there an alternative approach to use images that won’t become blurry when the resolution changes?

    Regards,
    Adnan

    1 Reply Last reply
    0
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #2

      I've used standard SVG files without a problem. Can you post one of your smaller .svg files? I'd like to see what specifically Qt is complaining about.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Redman
        wrote on last edited by
        #3

        Why dont you use
        https://doc.qt.io/qt-6/qml-qtquick-vectorimage-vectorimage.html

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved