Catch key combination (TAB + arrow up/down)



  • Hi, i need to catch event for TAB + arrow up/down...as i know, it is only possible with modifiers + key.

    Is there some way for archieve this? I want to implement catch of event where user presses first arrow up/down and then TAB key ... i want to emit signal when in the moment arrow up/down and tab key are pressed



  • There is not modifiers for this. You need to do normal programing practice for this. See if the following can help.

    @void MyWidget::keyPressEvent(QKeyEvent *kevt){
    qDebug() << "Key Press Event Happend =" << kevt->text();
    if (kevt->key() == Qt::Key_Up && prevKey == Qt::Key_Tab){
    qDebug() << "Up key and Tab"<<endl;
    }
    prevKey = kevt->key();
    return;
    }@

    It works for the first time. You need to check autorepeat. If user checks keeps the up arrow in pressed state, this logic may fail. You need to add additional logic to this.



  • yep, its usable. thanks for your time and wisdom! peace :)


Log in to reply
 

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