PDA

View Full Version : keyevent



mero
12th June 2011, 03:47
How can I catch Ctrl+Shift+TAB ?



if (k->key() == Qt::Key_Tab)
{
if (k->modifiers() == Qt::ControlModifier)
{


This is for Ctrl+Tab, but how can I catch Ctrl+Shift+Tab ?

Added after 40 minutes:

OK, I found solution:



if ((k->key() == Qt::Key_Backtab) && (k->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)))

wysota
13th June 2011, 10:16
This would be better:


if ((k->key() == Qt::Key_Backtab) && (k->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier)))

caduel
13th June 2011, 11:32
(k->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier) == (Qt::ControlModifier | Qt::ShiftModifier)
or

(k->modifiers() & Qt::ControlModifier) && (k-<modifiers() & Qt::ShiftModifier)

would be best