I'd like the child's handling of QKeyEvent
not to be executed when it's just a modifier key that's being pressed. The following code does the job, but it's unwieldy to list them all like that. Is there a built-in way to do that?
void TextEditor::keyPressEvent(QKeyEvent *event)
{
switch(event->key())
{
case Qt::Key_Shift:
case Qt::Key_Control:
case Qt::Key_Alt:
case Qt::Key_Meta:
case Qt::Key_Mode_switch:
return QPlainTextEdit::keyPressEvent(event);
}
// handle the event...
}