]> git.lyx.org Git - lyx.git/commitdiff
Fix bug http://bugzilla.lyx.org/show_bug.cgi?id=5421
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 3 Nov 2008 09:55:50 +0000 (09:55 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 3 Nov 2008 09:55:50 +0000 (09:55 +0000)
* GuiKeySymbol.cpp (print): when asked for Portable representation of
KeySequences, qt outputs Ctrl+x instead of Command-x. Therefore, we
we do it by hand.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27233 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiKeySymbol.cpp

index d4a73ffebb77b5bdffca96f090597718a722012c..314c7d6731632a7c412c51c1723e34322c41e754 100644 (file)
@@ -694,9 +694,25 @@ docstring const KeySymbol::print(KeyModifier mod, bool forgui) const
                tmpkey += Qt::AltModifier;
 
        QKeySequence seq(tmpkey);
+       QString str;
+       
+       if (forgui)
+               str = seq.toString(QKeySequence::NativeText);
+       else {
+#ifdef Q_WS_MACX
+               // Qt/Mac does not use Command and friends in the
+               // portable case, but the windows-like Control+x (bug 5421).
+               str = seq.toString(QKeySequence::NativeText);
+               str.replace(QChar(0x21E7), qt_("Shift-"));
+               str.replace(QChar(0x2303), qt_("Control-"));
+               str.replace(QChar(0x2325), qt_("Option-"));
+               str.replace(QChar(0x2318), qt_("Command-"));
+#else
+               str = seq.toString(QKeySequence::PortableText); 
+#endif
+       }
 
-       return qstring_to_ucs4(seq.toString(forgui ? QKeySequence::NativeText
-                                           : QKeySequence::PortableText));
+       return qstring_to_ucs4(str);
 }