I would like to implement keyboard shortcuts for my QGraphicsScene. My graphical objects are derived from QGraphicItem and QObject, so I can use signal/slot connections.
I'm already using QActions for context menus and now I would like to use some of QActions also as actions for keyboard shortcuts on the selected item.
My QGraphicsItems have enabled ItemIsFocusable
and ItemIsSelectable
via setFlag();
I can receive keyPressEvent(QKeyEvent* event)
but in such case I would have to manually test event->key() == Qt::Key_xxx
Is there any way how to do this automatically?
- I tried to compare QKeyEvent with QKeySequence, but this doesn't work (because sequence can contain multiple keys).
Thanks for any help