Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw SVG using QML

Tags:

qt

qml

How can I draw a SVG using qml in simple words?

According to QtDocs it is possible to draw a SVG using this code:

Path {
    startX: 50; startY: 50
    PathSvg { path: "L 150 50 L 100 150 z" }
}

But actually it doesn't. So, how can I draw SVG?

like image 296
Nixmd Avatar asked Sep 10 '25 07:09

Nixmd


1 Answers

If you want to show a path, you must use it within a Shape:

Shape {
    ShapePath {
        fillColor: "red"
        strokeWidth: 2
        strokeColor: "blue"
        startX: 50; startY: 50
        PathSvg { path: "L 150 50 L 100 150 z" }
    }
}
like image 174
Mohammad Reza Rastegari Avatar answered Sep 13 '25 04:09

Mohammad Reza Rastegari