Palmik
21st February 2010, 16:35
Hi,
I sub-classed QGraphicsSvgItem and QGraphicsLayoutItem to be able to add svg item easily to layouts. I achieved this general goal, but now I have few problems with functions like setRotation(), setPos(), setTransformOriginPoint() (those are the only three I discovered).
I should also add that I was inspired by this (http://qt.gitorious.org/qt/qt/trees/master/examples/graphicsview/basicgraphicslayouts)
The problems
setRotation(..) - The item is rotated, but somehow when the layout is resized the item is resized in wrong direction (i.e. you rotated some item by 90° now when you increase width of layout the height of the item is stretched instead)
setPos(..) - does not seem to work at all
setTransformOriginPoint(..) - does work only when you change it in paint(..) method itself (Edit: this probably only apply when you set the origin point as boundingRect().center() - the reason is now obvious to me :))
Now, you probably can not help me without source... so, here it is (http://filebeam.com/243bb452b9f418ef9998ea50d0858c12) with simple TestCase project
I sub-classed QGraphicsSvgItem and QGraphicsLayoutItem to be able to add svg item easily to layouts. I achieved this general goal, but now I have few problems with functions like setRotation(), setPos(), setTransformOriginPoint() (those are the only three I discovered).
I should also add that I was inspired by this (http://qt.gitorious.org/qt/qt/trees/master/examples/graphicsview/basicgraphicslayouts)
The problems
setRotation(..) - The item is rotated, but somehow when the layout is resized the item is resized in wrong direction (i.e. you rotated some item by 90° now when you increase width of layout the height of the item is stretched instead)
setPos(..) - does not seem to work at all
setTransformOriginPoint(..) - does work only when you change it in paint(..) method itself (Edit: this probably only apply when you set the origin point as boundingRect().center() - the reason is now obvious to me :))
Now, you probably can not help me without source... so, here it is (http://filebeam.com/243bb452b9f418ef9998ea50d0858c12) with simple TestCase project