From: Bo Peng Date: Wed, 31 Oct 2007 17:15:10 +0000 (+0000) Subject: PrefShortcuts: use KeySequence::ForGui to display shortcuts X-Git-Tag: 1.6.10~7583 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6cf20c52b7a2f4453fe74a65057df97c10046497;p=features.git PrefShortcuts: use KeySequence::ForGui to display shortcuts git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21309 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/CustomizedWidgets.cpp b/src/frontends/qt4/CustomizedWidgets.cpp index 32c09f7793..65d847742c 100644 --- a/src/frontends/qt4/CustomizedWidgets.cpp +++ b/src/frontends/qt4/CustomizedWidgets.cpp @@ -93,7 +93,7 @@ void ShortcutLineEdit::keyPressEvent(QKeyEvent * e) break; default: appendToSequence(e); - setText(toqstr(keysequence_.print(KeySequence::BindFile))); + setText(toqstr(keysequence_.print(KeySequence::ForGui))); } } diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 07610fac39..4a957c7dcc 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1874,10 +1874,7 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun, string const action_name = lyxaction.getActionName(action); QString const lfun_name = toqstr(from_utf8(action_name) + " " + lfun.argument()); - // use BindFile format instead of a more verbose form Portable. If the - // Shortcut dialog can hide all the bind file stuff, and on_removePB_pressed - // can parse Portable format, Portable format can be used. - QString const shortcut = toqstr(seq.print(KeySequence::BindFile)); + QString const shortcut = toqstr(seq.print(KeySequence::ForGui)); item_type item_tag = tag; QTreeWidgetItem * newItem = NULL; @@ -1925,6 +1922,8 @@ QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun, newItem->setText(0, lfun_name); newItem->setText(1, shortcut); + // record BindFile representation to recover KeySequence when needed. + newItem->setData(1, Qt::UserRole, QVariant(toqstr(seq.print(KeySequence::BindFile)))); setItemType(newItem, item_tag); return newItem; } @@ -1987,7 +1986,7 @@ void PrefShortcuts::on_removePB_pressed() // removing all selected items anyway. QList items = shortcutsTW->selectedItems(); for (int i = 0; i < items.size(); ++i) { - string shortcut = fromqstr(items[i]->text(1)); + string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString()); string lfun = fromqstr(items[i]->text(0)); FuncRequest func = lyxaction.lookupFunc(lfun); item_type tag = static_cast(items[i]->data(0, Qt::UserRole).toInt());