[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?

    Edit:

    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 :
    @
    installEventFilter(this);
    @

    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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.