PDA

View Full Version : Disable QGraphicsView scrolling with arrow keys



sakya
9th September 2013, 11:45
Hi,

I have a QGraphicsView displaying some QGraphicsItem.
One of this QGraphicsItem is a pointer the user can move with keys.
The QGraphicsScene rect can be bigger than the view (so it is scrolled when the "pointer" reaches the edge).

All works fine if I use keys different from the arrow keys: the pointer moves in the view and scolls it when it is needed.
I have a problem when using the arrow keys: when I press the right arrow (for example) the view scrolls automatically.

Is there a way to disable the QGraphicsView scrolling with the arrow keys?
I tried to ignore the arrow keys in the view's keyPressEvent but this way also the QGraphicsItem don't receive the keyPressEvent for the arrow keys.

Thanks. ;)