[Interest] Shift+Tab Shortcut
Daniel Otto Bolognani
daniel.bolognani at totvs.com.br
Fri Sep 20 22:27:40 CEST 2013
Hello,
Installing an eventfilter I can get the keyrelease event and test for backtab, so it works too. To intercept the backtab (shift tab), the only way is through eventfilter and in the focusout event, I don't see why this happens, but at least there are other options.
Thanks for the reply
-----Original Message-----
From: interest-bounces+daniel.bolognani=totvs.com.br at qt-project.org [mailto:interest-bounces+daniel.bolognani=totvs.com.br at qt-project.org] On Behalf Of Andre Somers
Sent: sexta-feira, 20 de setembro de 2013 17:00
To: interest at qt-project.org
Subject: Re: [Interest] Shift+Tab Shortcut
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é
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list