From 45d8d723b62658a84eed77291b3cee74fdb4f20d Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 26 Oct 2023 09:07:15 +0200 Subject: [PATCH] Core: Add VSCode keyboard mapping Change-Id: I9924eaeba3013ce114890bc0be414ef4eafaddb2 Reviewed-by: Eike Ziller --- .../schemes/MS_Visual_Studio_Code.kms | 28 +++++++++++++++++++ .../coreplugin/actionmanager/commandsfile.cpp | 7 ++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 share/qtcreator/schemes/MS_Visual_Studio_Code.kms diff --git a/share/qtcreator/schemes/MS_Visual_Studio_Code.kms b/share/qtcreator/schemes/MS_Visual_Studio_Code.kms new file mode 100644 index 00000000000..cce5508957e --- /dev/null +++ b/share/qtcreator/schemes/MS_Visual_Studio_Code.kms @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/coreplugin/actionmanager/commandsfile.cpp b/src/plugins/coreplugin/actionmanager/commandsfile.cpp index 18866662ba2..9cf530d7ff4 100644 --- a/src/plugins/coreplugin/actionmanager/commandsfile.cpp +++ b/src/plugins/coreplugin/actionmanager/commandsfile.cpp @@ -106,7 +106,12 @@ QMap> CommandsFile::importCommands() const QTC_ASSERT(!currentId.isEmpty(), continue); const QXmlStreamAttributes attributes = r.attributes(); if (attributes.hasAttribute(ctx.valueAttribute)) { - const QString keyString = fromAttribute(attributes.value(ctx.valueAttribute)); + QString keyString = fromAttribute(attributes.value(ctx.valueAttribute)); + if (HostOsInfo::isMacHost()) + keyString = keyString.replace("AlwaysCtrl", "Meta"); + else + keyString = keyString.replace("AlwaysCtrl", "Ctrl"); + QList keys = result.value(currentId); result.insert(currentId, keys << QKeySequence(keyString)); }