0

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.

Community
  • 1
  • 1
Bearded Beaver
  • 646
  • 4
  • 21

1 Answers1

1

Use QKeySequenceEdit::setKeySequence.

Peter K
  • 1,372
  • 8
  • 24