QKeySequence (modifier+key) only works after pressing the key first without the modifier



  • Hi, I have a simple QWidget. I want to run one of its methods when I press Alt+`.

    This shortcut works fine, but only when I've pressed ` first at least once (so without the Alt key). If I do this once, the hotkey will continue to work as expected for the rest of the session.



  • @WoGi
    I have tried to reproduce it , but could not .
    I tried this and works for me.

        QShortcut *shortcut = new QShortcut(QKeySequence("Alt+`"), this);
        QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(yourSolt()));

Log in to reply
 

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