]> git.lyx.org Git - features.git/commitdiff
PrefShortcuts: use KeySequence::ForGui to display shortcuts
authorBo Peng <bpeng@lyx.org>
Wed, 31 Oct 2007 17:15:10 +0000 (17:15 +0000)
committerBo Peng <bpeng@lyx.org>
Wed, 31 Oct 2007 17:15:10 +0000 (17:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21309 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/CustomizedWidgets.cpp
src/frontends/qt4/GuiPrefs.cpp

index 32c09f779384f2898a319e2df55074cb1fac3b7f..65d847742c0f65f193c596d0ce88d5c1fcd5c7a2 100644 (file)
@@ -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)));
        }
 }
 
index 07610fac39becee3e4b81e4f2d379e856d107624..4a957c7dcc6deb00e68a739e3c3db4e4bf8f0217 100644 (file)
@@ -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<QTreeWidgetItem*> 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<item_type>(items[i]->data(0, Qt::UserRole).toInt());