Hello!
I have a QGraphicsView to which I connected a QScene. Now I'd like to intercept key pressed events on my QGraphicsView but there aren't SIGNALS allowing that...what are the functions to do so?
Thanks
Hello!
I have a QGraphicsView to which I connected a QScene. Now I'd like to intercept key pressed events on my QGraphicsView but there aren't SIGNALS allowing that...what are the functions to do so?
Thanks
QGraphicsView::keyPressEvent() is what you want.
So, subclass QGraphicsView and override keyPressEvent().
Last edited by Urthas; 20th August 2010 at 17:18.
Thanks for the response.
But how can I recognise the pressed key? In keyPressedEvent there isn't a returned key code which enables me to handle the event...
The parameter to QGraphicsView::keyPressEvent() is of type QKeyEvent, which has a function called key(). See Qt::Key for the list of keyboard codes.
ok, thanks a lot! I've found all I need for my program
Bookmarks