ba.vishnu
ba.vishnu

Reputation: 11

Draw a line in a circular path in QML?

I want to draw a line in circular path where this line's length should increase ( from 0 to the complete circle circumference) while it is moving in that circular path. Is there any solution for this ?

Upvotes: 0

Views: 2101

Answers (1)

lolo
lolo

Reputation: 704

You can use Canvas :

Canvas {
    id: mycanvas
    width: 200
    height: 200
    onPaint: {
        var ctx = getContext("2d");
        ctx.beginPath();
        ctx.arc(x, y, radius, startAngle, endAngle, anticlockwise);
        ctx.stroke();
    }
}

You can find explanation about the arc method in the documentation: you simply need to define startAngle and endAngle in your QML and update them when you want to move or increase the line.

Upvotes: 1

Related Questions