[Qt-interest] QGraphicsItem ignore scene translation/transform?

Thomas Fjellstrom tfjellstrom at shaw.ca
Fri Jan 22 12:48:31 CET 2010


I'm trying to get a few items to completely ignore the scene's current 
translation and transforms. That is, I'd like the item to stay at a fixed 
position in the view, regardless of any zooming, or movement in the view 
itself. And do that without it looking like I'm manually moving the item 
with the view (ie: it lagging slightly behind the scrolling).

I've played with the QGraphicsItem::ItemIgnoresTransformations flag, it 
definitely doesn't ignore translations in the scene at all, and it seems to 
mess up the "y rotate" animation I added to a couple items. It looks like 
its shifting the item's coordinates around a little. I use: 
setTransformOriginPoint(size().width()/2, size().height()/2); to set the 
transform point to the centre of the item, so my item (without the ignore 
flag) flips around the y axis (centre of the item) nicely. With the ignore 
flag, it flips around the right hand edge of the item, and seems to shift 
its x position as it flips.

I'm using Qt 4.6.0 (from qt.nokia.com, not a distro package), on linux 
2.6.32 + KDE 4.3.4.

Is there any way to get the behaviour I'm looking for? Thank you.

-- 
Thomas Fjellstrom
tfjellstrom at shaw.ca



More information about the Qt-interest-old mailing list