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. Rendering parts of svg-file in QML

Rendering parts of svg-file in QML

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 4.3k 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.
  • K Offline
    K Offline
    kassinen
    wrote on last edited by
    #1

    Hi,

    I am trying to draw parts of an svg-file in QML. The file is svg-cards.svg and can be obtained from "here":http://svg-cards.sourceforge.net/
    The cards are inside an SVG-group but when I try to use a single cards in qml image-element like this
    @
    Image{
    sourceSize.width: parent.width
    sourceSize.height: parent.height
    source: "svg-cards.svg#black_joker"
    }@

    It shows the whole SVG-file with all the cards in it. Is it even possible to use the SVG-files like this in QML. I know that I can do this in Qt with QGraphicsSvgItem.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      task_struct
      wrote on last edited by
      #2

      Hello,

      AFAIK you can't do this with Image element. You should subclass "QDeclarativeItem":http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeitem.html to provide your custom QML element.

      "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

      • Linu...
      1 Reply Last reply
      0
      • K Offline
        K Offline
        kassinen
        wrote on last edited by
        #3

        Ok,

        I might just do the cropping of the cards and save them to different .png-files. Are there any differences in performance when rendering png and svg -files?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          PNG should be much faster :-)

          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