Hi to all,
I would know how to correctly write an event handler for example a keyPressEvent.
I wrote this event that I would catch when I press the space key:
Qt Code:
{ switch( pe->key() ) { case Qt::Key_Space: { pe->accept(); qDebug() << "Space pressed"; m_wave->playSound(); } break; default: pe->ignore(); break; } }To copy to clipboard, switch view to plain text mode
This is the correct way to write it? Must I accept the event with the right key and ignore in other case? And must I pass the event to the base class?
I don't know why in my case in doesn't work.
Best
Bookmarks