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. How using svg file in Shape

How using svg file in Shape

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 448 Views
  • 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.
  • M Offline
    M Offline
    Mihaill
    wrote on last edited by
    #1

    Hi!
    How I can using svg file in Shape?

    JoeCFDJ 1 Reply Last reply
    0
    • M Mihaill

      Hi!
      How I can using svg file in Shape?

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      @Mihaill

      import QtQuick 2.0
      
      Item {
         width: 200
         height: 200
      
         Image {
             id: svgImage
             source: "file:///path/to/your/svg/file.svg"
             anchors.centerIn: parent
         }
      
         Shape {
             id: svgShape
             fill: svgImage
             strokeColor: "black"
             strokeWidth: 2
             shape: Path {
                 // Define the path for your shape
             }
         }
      }
      
      M 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        @Mihaill

        import QtQuick 2.0
        
        Item {
           width: 200
           height: 200
        
           Image {
               id: svgImage
               source: "file:///path/to/your/svg/file.svg"
               anchors.centerIn: parent
           }
        
           Shape {
               id: svgShape
               fill: svgImage
               strokeColor: "black"
               strokeWidth: 2
               shape: Path {
                   // Define the path for your shape
               }
           }
        }
        
        M Offline
        M Offline
        Mihaill
        wrote on last edited by Mihaill
        #3

        @JoeCFD What need set in Path?

        M 1 Reply Last reply
        0
        • M Mihaill

          @JoeCFD What need set in Path?

          M Offline
          M Offline
          Mihaill
          wrote on last edited by
          #4

          @Mihaill need load svg in QML Image and set

          sourceSize.width: paintedWidth
          sourceSize.height: paintedHeight
          
          1 Reply Last reply
          0
          • M Mihaill has marked this topic as solved on

          • Login

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