QTreeWidgetItem * newItem = nullptr;
// for unbind items, try to find an existing item in the system bind list
if (tag == KeyMap::UserUnbind) {
- QList<QTreeWidgetItem*> const items = shortcutsTW->findItems(lfun_name,
- Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0);
+ QList<QTreeWidgetItem*> const items = shortcutsTW->findItems(shortcut,
+ Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 1);
for (auto const & item : items) {
- if (item->text(1) == shortcut) {
+ if (item->text(0) == lfun_name || lfun == FuncRequest::unknown) {
newItem = item;
break;
}
// this should not happen
newItem = new QTreeWidgetItem(shortcutsTW);
}
+ newItem->setText(0, lfun_name);
+ newItem->setText(1, shortcut);
}
- newItem->setText(0, lfun_name);
- newItem->setText(1, shortcut);
// record BindFile representation to recover KeySequence when needed.
newItem->setData(1, Qt::UserRole, toqstr(seq.print(KeySequence::BindFile)));
setItemType(newItem, tag);