[Qt-interest] Immovable QGraphicsItems when the QGraphicsView moves. How?

Salvatore Iovene salvatore at iovene.com
Sat Apr 17 17:24:40 CEST 2010


Hello list,
I'm making a small game using Qt, implemented so that there is:

    * A large plane where the action happens (4096x4096px)
    * A small object (around 40px in diameter) controller by the player
    * A view sized 800x480px that follows that object

I move the view using the ensureVisible() function, because translating
the view doesn't work (see
http://bugreports.qt.nokia.com/browse/QTBUG-7328 ).

The plane is fixed (it never moves), and has no parent. The object
controller by the player has the plane as parent.

Now let me get to the question.

I'd like to have so OSD (On Screen Display) objects, such as Score, a
Radar Map, and other overlay elements that are not supposed to move.

The problem is that they get world coordinates, and since the
QGraphicsView is moving around, they get out of the scene.

Could you please recommend a way to have these object static in my
scene?

Thanks a lot!

-- 
Salvatore Iovene
http://www.iovene.com/
http://www.geekherocomic.com/




More information about the Qt-interest-old mailing list