X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiKeySymbol.cpp;h=e5d3d796d96133e6329c32a3d39208da9837177b;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=d4a73ffebb77b5bdffca96f090597718a722012c;hpb=4649511c2cf78032f81576c33dec46eafca304e5;p=lyx.git diff --git a/src/frontends/qt4/GuiKeySymbol.cpp b/src/frontends/qt4/GuiKeySymbol.cpp index d4a73ffebb..e5d3d796d9 100644 --- a/src/frontends/qt4/GuiKeySymbol.cpp +++ b/src/frontends/qt4/GuiKeySymbol.cpp @@ -3,7 +3,7 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Asger & Jürgen + * \author Asger & Jürgen * * Full author contact details are available in file CREDITS. */ @@ -402,6 +402,7 @@ static std::string const qkey_to_string(int lkey) case Qt::Key_Y: return "y"; case Qt::Key_Z: return "z"; + case Qt::Key_Return: return "Return"; case Qt::Key_Escape: return "Escape"; case Qt::Key_Tab: return "Tab"; case Qt::Key_Backspace: return "BackSpace"; @@ -637,7 +638,7 @@ void KeySymbol::init(string const & symbolname) bool KeySymbol::isOK() const { - bool const ok = !(text_.empty() && key_ == Qt::Key_unknown); + bool const ok = !(text_.empty() && qkey_to_string(key_).empty()); LYXERR(Debug::KEY, "isOK is " << ok); return ok; } @@ -694,9 +695,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); }