[Qt-interest] QGraphicsView, invalidateScene and ForegroundLayer
Christian Gagneraud
cgagneraud at techworks.ie
Wed Jul 14 15:34:41 CEST 2010
Hi there,
First of all: I'm using NokiaQtSDK-1.0, on fedora-12, 32 bits.
According to the documentation QGraphicsView::invalidateScene() can be
used to reschedule a redraw of layers. And especially it says "You can
call this function to notify QGraphicsView of changes to the
background or the foreground of the scene", I'm agree that further up
the doc says "Note that QGraphicsView currently supports background
caching only [...]", and that what has confused me at first.
I tried to use this function to reschedule a redraw of the foreground
from QGraphicsView::mouseEvent(), but it didn't work, i then looked at
the source code, and realized that the code deals only with the
background layer (ie, it does absolutely nothing if layers doesn't
contain QGraphicsScene::BackgroundLayer).
So my question is: Is it me that misunterstood the documentation? Is
it QGraphicsView::invalidateScene() that doesn't do what's advertised
or is it the documentation which is wrong or unclear?
I ended up calling QGraphicsScene::invalidateScene() from
QGraphicsScene::mouseEvent(), but I'm not really happy, because all my
logic and the revelant informations are managed from inside the view,
not the scene.
What I'm trying to do, is draw a grid on the background, and draw
rules and a snapped-to-grid mouse pointer on the foreground.
Regards,
Chris
--
Christian Gagneraud,
Electronics and software engineer
TechWorks Marine Ltd
4a, Park Lane
Dun Laoghaire, Co Dublin
Ireland
Tel: + 353 1 2365990
Fax: + 353 1 2365992
Web: www.techworks.ie
More information about the Qt-interest-old
mailing list