X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiPrefs.cpp;h=31da12936fd1a3577a2ac200aaf3855591ae0fee;hb=1dedd398;hp=2b6b9cd1cb667952e7ad80352418fcbc812b9ead;hpb=11d5e31c65c36a8ba67a72b2486e1bdc1406f1e0;p=lyx.git diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp index 2b6b9cd1cb..31da12936f 100644 --- a/src/frontends/qt/GuiPrefs.cpp +++ b/src/frontends/qt/GuiPrefs.cpp @@ -3087,10 +3087,10 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun, QTreeWidgetItem * newItem = nullptr; // for unbind items, try to find an existing item in the system bind list if (tag == KeyMap::UserUnbind) { - QList const items = shortcutsTW->findItems(lfun_name, - Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0); + QList 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; } @@ -3125,10 +3125,10 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun, // 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);