Skip to content

Commit eda749d

Browse files
committed
Show correct shortcut text on macOS.
1 parent 08d0186 commit eda749d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Telegram/SourceFiles/settings/settings_shortcuts.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ struct Labeled {
112112
};
113113
}
114114

115+
[[nodiscard]] QString ToString(const QKeySequence &key) {
116+
auto result = key.toString();
117+
#ifdef Q_OS_MAC
118+
result = result.replace(u"Ctrl+"_q, QString() + QChar(0x2318));
119+
result = result.replace(u"Meta+"_q, QString() + QChar(0x2303));
120+
result = result.replace(u"Alt+"_q, QString() + QChar(0x2325));
121+
result = result.replace(u"Shift+"_q, QString() + QChar(0x21E7));
122+
#endif // Q_OS_MAC
123+
return result;
124+
}
125+
115126
[[nodiscard]] Fn<void()> SetupShortcutsContent(
116127
not_null<Window::SessionController*> controller,
117128
not_null<Ui::VerticalLayout*> content) {
@@ -233,9 +244,9 @@ struct Labeled {
233244
? TextWithEntities()
234245
: removed
235246
? Ui::Text::Wrapped(
236-
TextWithEntities{ key.toString() },
247+
TextWithEntities{ ToString(key) },
237248
EntityType::StrikeOut)
238-
: TextWithEntities{ key.toString() });
249+
: TextWithEntities{ ToString(key) });
239250
keys->setTextColorOverride((recording == raw)
240251
? st::boxTextFgGood->c
241252
: removed

0 commit comments

Comments
 (0)