[SOLVED] keyPressEvent Qt_Key doesn't work
-
I have the keyPressEvent method and inside I have something like that:
@if (event->key() == Qt::Key_Up) {
qDebug() << "up key";
} else if (event->modifiers().testFlag(Qt::AltModifier) && event->key() == Qt::Key_Enter) {
qDebug() << "ctrl+enter"
}@But doesn't work. Other keys works normally, but keys like Ctrl, Alt, Shift, Enter, and so on, doesn't.
Enter key works only when I put 16777220 instead of Qt_Key_Enter
-
Hi,
Are you sure it's not Qt::Key_Return that you want to use ? AFAIK, Key_Enter is for the keypad "Return"
-
Thanks, it's working.
-
You're welcome !
Since your keys are working now, please update the thread title prepending [solved] so other forum users may know solution has been found :)