Important: Please read the Qt Code of Conduct -

Catch key combination (TAB + arrow up/down)

  • Hi, i need to catch event for TAB + arrow up/ 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

  • Qt Champions 2017

    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();

    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