Bearded Beaver
Bearded Beaver

Reputation: 656

Propagate keyEvent from widget to QKeySequenceEdit

I have a QTreeWidget and QKeySequenceEdit and I want pressing shortcuts in QTreeWidget lead to editing shortcut in QKeySequenceEdit. I've installed eventFilter and constructed the corresponding QShortcut using this solution:

How can I capture QKeySequence from QKeyEvent depending on current keyboard layout?

But I'm stuck at sending event to QKeySequenceEdit. Here is a piece of code in eventFilter

qDebug()<<QKeySequence(keyInt).toString();
QShortcutEvent *shortcutEvent = new QShortcutEvent(QKeySequence(keyInt), QShortcut(QKeySequence(keyInt), this).id());
qApp->postEvent(ui->keySequenceEdit, shortcutEvent);
return true;

qDebug outputs right keys, but QKeySequenceEdit does not react.

Upvotes: 0

Views: 284

Answers (1)

Peter K
Peter K

Reputation: 1382

Use QKeySequenceEdit::setKeySequence.

Upvotes: 1

Related Questions