PDA

View Full Version : multiple key combo event



tikay
28th June 2010, 04:14
Hi,

I'd like to react to multi-key combos (e.g. Key_Q+Key_W) that are being held down. So when you hold down a key combo, the event should be called all the time, just the same way as it works with single key events. I tried to use QShortcuts and enable autorepeat for them, but that didn't work:

keyCombos_.push_back(new QShortcut(QKeySequence(Qt::Key_W, Qt::Key_D), this));
connect(keyCombos_[0], SIGNAL(activated()), SLOT(keySequenceEvent_WD()));
setShortcutAutoRepeat(keyCombos_[0]->id(), true);
When using this approach I also have the problem that I can't catch single Key_W (or whatever the first Key in the keysequence is) strokes anymore.

Btw is there a way to remove the waiting time before a key is autorepeated?

Thanks,
Thomas

aamer4yu
28th June 2010, 06:33
QAbstractButton::setAutoRepeatInterval

tikay
28th June 2010, 16:26
This would be the functionality that I'm looking for, but I'm not using buttons, I'm using key events and key sequences.

Thanks,
Thomas