Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Scalable graphics with Shape



  • Hi all,

    How would I efficiently draw a path in a Shape with coordinates relative to the size of the Shape? Of course I could do something like:

    Shape {
        id: wrap
        anchors.fill: parent
        ShapePath {
            strokeColor: "red"
            strokeWidth: 10
            startX: .2 * wrap.width; startY: .3 * wrap.height
            PathLine { x: .3 * wrap.width; y: .5 * wrap.height}
            PathLine { x: .1 * wrap.width; y: .4 * wrap.height}
            PathLine { x: .2 * wrap.width; y: .1 * wrap.height}
        }
    }
    

    but this feels like a cumbersome API with a lot of redundant bindings (one should be enough, right?)


Log in to reply