Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, August 2006
QGraphicsView -- background mouse events


Message 1 in thread

Hi

I'm implementing a direct-manipulation graph editor type thingy, and one of 
the things I'd like to do is pick up mouse events which occur in the scene 
when the mouse is not over any item. I've tried two approaches, both have 
some shortcomings, I'm wondering if you can give any guidance on whether 
there's a different way to do what I want. The approaches I've tried:

1) Create a special background QGraphicsItem which is at the back of the 
z-order and collect all clicks from it. This works well except that I need 
to work out how to resize it so that it is always big enough to collect all 
clicks, but never so big that it causes the scroll bars to appear 
unnecessarily (not sure how to handle this at all, what if there are 
multiple views?).

2) Subclass QGraphicsScene and collect mouse events there. This works great 
for mouse press and mouse release, but doesn't work at all for mouseMove 
(mouseMove is only propogated to the scene if there is a mouse grabber item 
(is this a bug?)).

Thanks!

Ross. 

--
 [ signature omitted ]