[Interest] Shift+Tab Shortcut

Andre Somers andre at familiesomers.nl
Fri Sep 20 22:00:03 CEST 2013


Op 20-9-2013 21:13, Daniel Otto Bolognani schreef:
> Hello list!
>
> We ported our software from QT3 Support to Pure QT4 and now we are facing some different behaviour on the shortcuts, we have managed almost all of the problems, unless the Shift+Tab shortcut that we need to intercept.
>
> When it was Qt3 Support we had this:
> Q3Action *q3act = new Q3Action(this);
> QKeySequence *ks = new QKeySequence(Qt::Key_Backtab);
> q3act->setAccel(*ks);
> connect(q3act,SIGNAL(activated()),this,SLOT(keypress()));
>
> And when pressed, the SLOT keypress was called and everything was working like it should.
>
> To port to QT4 we did this:
> QAction *act3 = new QAction(this);
> QKeySequence *ks = new QKeySequence(Qt::Key_Backtab);
> act3->setShortcut(*ks);
> addAction(act3);
> connect(act3,SIGNAL(triggered()),this,SLOT(keypress()));
>
>
> All the other shortcuts worked unless the backtab (shift+tab)! We have tried to use this on the keypress event too:
> void keyPressEvent( QKeyEvent * e )
> {
>    // Even if I test Qt::Key_Tab it doens't work either
>    if ((e->modifiers()==Qt::ShiftModifier && e->key() == Qt::Key_Backtab) || e->key()==Qt::Key_Backtab)
>    {
>      QMessageBox msgbox;
>      msgbox.setText("backtab");
>      msgbox.exec();
>    }
> }
>
> It hadn't worked either.
>
> The only thing that resolved this was to grab the FocusOut event and test if it was a backtab reason, but in my personal opinion it is an horrible solution!
> Aren't these 2 other methods supposed to work? What are we doing wrong?
>
> Thanks in advance,
> Daniel
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
Did you try installing an eventfilter on your QApplication object?

André




More information about the Interest mailing list