View Full Version : QGraphicsView, QScene and keyboard
harmodrew
20th August 2010, 12:48
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
Urthas
20th August 2010, 17:00
QGraphicsView::keyPressEvent() is what you want.
So, subclass QGraphicsView and override keyPressEvent().
harmodrew
20th August 2010, 17:53
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...
Urthas
20th August 2010, 18:05
The parameter to QGraphicsView::keyPressEvent() is of type QKeyEvent, which has a function called key(). See Qt::Key for the list of keyboard codes.
harmodrew
21st August 2010, 21:22
ok, thanks a lot! I've found all I need for my program :)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.