chore(macOS): use native text for ShortcutEdit's label

This means that it will be shown translated and on Apple platforms
it will resemble a key sequence from the menu bar.
This commit is contained in:
Gary Wang 2025-03-08 00:31:49 +08:00
parent cbd006bae7
commit 3203d7f598

View File

@ -105,8 +105,8 @@ ShortcutEdit::ShortcutEdit(QWidget *parent)
connect(this, &ShortcutEdit::shortcutsChanged, this, [=](){
QStringList shortcutTexts;
for (const QKeySequence & shortcut : m_shortcuts) {
shortcutTexts.append(shortcut.toString());
for (const QKeySequence & shortcut : std::as_const(m_shortcuts)) {
shortcutTexts.append(shortcut.toString(QKeySequence::NativeText));
}
m_shortcutsLabel->setText(shortcutTexts.isEmpty() ? tr("No shortcuts") : shortcutTexts.join(", "));
m_shortcutsLabel->setDisabled(shortcutTexts.isEmpty());