this, SLOT(selectTypewriter(QString)));
#endif
+#if QT_VERSION >= 0x060000
+ const QStringList families(QFontDatabase::families());
+#else
QFontDatabase fontdb;
- QStringList families(fontdb.families());
+ const QStringList families(fontdb.families());
+#endif
for (auto const & family : families) {
screenRomanCO->addItem(family);
screenSansCO->addItem(family);
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);
if (item) {
user_bind_.bind(&k, func);
shortcutsTW->sortItems(0, Qt::AscendingOrder);
- item->parent()->setExpanded(true);
+ if (item->parent())
+ item->parent()->setExpanded(true);
shortcutsTW->setCurrentItem(item);
shortcutsTW->scrollToItem(item);
} else {