PDA

View Full Version : Resizable & rotatable GraphicsItem



arunpk
1st June 2016, 13:38
I am trying to do an application in which I want to achieve the functionality of rotating and resizing the Graphics Item which is basically a Rectangle drawn using paint.

I have used following code to achieve this functionality.
This code is not working correctly when I rotate it and then resize it and then again try to rotate then the centre point will be jumped to another point.

Find my test code attached herewith.

Can anyone tell me what is going wrong in my above code and what I should change to make my custom graphics item resizeable & rotatable.

d_stranz
2nd June 2016, 18:41
Don't have time to look at your code, but I suspect you are making a common mistake. When rotating any graphical object (in whatever programming language you choose) the method is three steps: first translate your object so that its center corresponds to the point around which you want to rotate, then rotate the transformed object, then translate its center point back to the original location.