pispipepe
22nd June 2010, 20:16
Hello
I try to rotate a item, the item was added in a graphicsscene, add the image jpg before the circle, i add the circle with mousepresevent with parameters xmouse and ymouse.
http://img132.imageshack.us/img132/5070/clipboard01zw.jpg (http://img132.imageshack.us/i/clipboard01zw.jpg/)
the promlem when i rotate the item (circle) the rotating point it uses is the point 0,0 of the image jpg, as it shows in the image.
numbers in the image
1.- Qgraphicsscene inside the Qgraphicsview
2.- Image JPG
3.-Item (circle) rotate fine
4.-Item (circle) rotate wrong
a = math.pi/45* value
sina = math.sin(a)
cosa = math.cos(a)
translationTransform=QTransform(1, 0, 0, 1, 0, 0);
rotationTransform=QTransform(cosa, sina, -sina, cosa, 0, 0);
scalingTransform=QTransform(1., 0, 0, 1.0, 0, 0);
transform = scalingTransform * rotationTransform * translationTransform;
self.scene.selectedItems()[0].setTransform(transform)
How i can do to rotate the circle from the center of the circle.
Sorry for my english.
I try to rotate a item, the item was added in a graphicsscene, add the image jpg before the circle, i add the circle with mousepresevent with parameters xmouse and ymouse.
http://img132.imageshack.us/img132/5070/clipboard01zw.jpg (http://img132.imageshack.us/i/clipboard01zw.jpg/)
the promlem when i rotate the item (circle) the rotating point it uses is the point 0,0 of the image jpg, as it shows in the image.
numbers in the image
1.- Qgraphicsscene inside the Qgraphicsview
2.- Image JPG
3.-Item (circle) rotate fine
4.-Item (circle) rotate wrong
a = math.pi/45* value
sina = math.sin(a)
cosa = math.cos(a)
translationTransform=QTransform(1, 0, 0, 1, 0, 0);
rotationTransform=QTransform(cosa, sina, -sina, cosa, 0, 0);
scalingTransform=QTransform(1., 0, 0, 1.0, 0, 0);
transform = scalingTransform * rotationTransform * translationTransform;
self.scene.selectedItems()[0].setTransform(transform)
How i can do to rotate the circle from the center of the circle.
Sorry for my english.