View Full Version : Connecting 2 points using QML

4th November 2011, 08:05

Good day to all.

May I ask for help? Basically, I want to connect 2 points using a line in QML. I can use Qt for this, but the thing is that I need to animate the connecting of 2 points. And I have little knowledge of Qt for animations. So I have to use QML for this.

I have one point of origin, say the bottom center of the screen. And when a user clicks anywhere on the screen, a line will draw from the origin to the point where the user clicked, and this is animated. Then, after reaching the end point, I have to return to the origin, like erasing the line until it reaches the origin (reversing the initial process)

I can draw a line now, but its only a vertical straight line, with animations too, just that. I don't know how to draw the diagonal line, given the point where the user clicked the screen. I think this will involve rotation, but I don't know how to rotate the line given just two points, the start point and end point.

Can anyone help me with this please? Or if there is any other way, please enlighten me.

Thank you very much in advance :D