Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #134 #162

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/gui/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,19 @@ QString InputConv::convertMouse(Qt::MouseButton bt, QEvent::Type type, Qt::Keybo
*/
QString InputConv::convertKey(const QString& text, int k, Qt::KeyboardModifiers mod)
{
QChar c;
if (specialKeys.contains(k)) {
return QString("<%1%2>").arg(modPrefix(mod)).arg(specialKeys.value(k));
c = text.isEmpty() ? QChar() : text.at(0);
if (text.isEmpty() || c.isSpace() || !c.isPrint()) {
return QString("<%1%2>").arg(modPrefix(mod)).arg(specialKeys.value(k));
} else {
// 'k' include the information about SHIFT so do not check 'mod'
// See #134
return QString("<%1>").arg(specialKeys.value(k));
}
}

QChar c;
// Escape < and backslash
if (text == "<") {
return QString("<%1%2>").arg(modPrefix(mod)).arg("lt");
} else if (text == "\\") {
return QString("<%1%2>").arg(modPrefix(mod)).arg("Bslash");
} else if (text.isEmpty()) {
if (text.isEmpty()) {
// on macs, text is empty for ctrl+key and cmd+key combos (with or without alt)
if (mod & ControlModifier || mod & CmdModifier) {
// ignore ctrl, alt and cmd key combos by themselves
Expand Down