Qt World Summit: Register Today!

[SOLVED] keyPressEvent accepts no letters

  • Hi there

    I'm using the keyPressEvent in my QMainWindow class like this:

    void MyMainWindow::keyPressEvent(QKeyEvent *keyEvent)
    qDebug() << keyEvent->key();

    But it only detects special keys like enter, ctrl, alt etc. but no letters or numbers. Did I oversee something?


    Found it. Because my QMainWindow class only posseses QSpinBox items the focus is always on them. Somehow the QMainWindow class catches special keys but letters or numbers go to the QSpinBox.

  • try it :

    for enable the keypress event filter ;

  • @mods - This is not a Qt Quick problem... Please move it to General and Desktop

Log in to reply