Propagate keyEvent from widget to QKeySequenceEdit

Bearded Beaver Source

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.

qtqkeyeventqkeysequence

Answers

answered 2 years ago Peter K #1
comments powered by Disqus