Is it possible to have a visible QGraphicsItem with no location?
With QGraphicsScene, is there any way to have items in the scene which will not be returned by items(QPoint) and still visible in the scene?
10 replies
Is it possible to have a visible QGraphicsItem with no location?
items belonging to a scene and which are visible, will have a location i.e. a geometry
With QGraphicsScene, is there any way to have items in the scene which will not be returned by items(QPoint) and still visible in the scene?
you are interested in the items(QPoint) call, so you can probably check the different options available for Qt::ItemSelectionMode and see if something suits you
items that are not located at this point, are of course still visible and will not be returned with items(QPoint) call …
I have a QGraphicsView which does certain actions based the items in the scene (for example re-framing the view to center and zoom on certain items). However, the scene also contains heads-up-display (HUD) items which must be ignored. Currently I’m filtering the HUD items when re-framing. I’m wondering if there is a more creative solution.
you are interested in the items(QPoint) call, so you can probably check the different options available for Qt::ItemSelectionMode and see if something suits you items that are not located at this point, are of course still visible and will not be returned with items(QPoint) call …
I don’t see an Qt::ItemSelectionMode that would apply, since I want to create an special item that would not be selected even though some other regular item at the same location would be.
Not necessarily; see also this message [lists.trolltech.com] from the mailing list.
I suspect you’re right then, and those are your best options. A fast way to do the filtering (however it’s done) might be to check QGraphicsItem::type() – or better (if you can), make all the HUD objects children of a single item and set QGraphicsItem::ItemHasNoContents on that parent item. That way (I think) you’d only have one QGraphicsItem to check.
You must log in to post a reply. Not a member yet? Register here!




