From 99a9c65807743fa5ad032fa3bcbfe23809fd3ad8 Mon Sep 17 00:00:00 2001 From: Aryaman Vinchhi Date: Mon, 7 Aug 2017 15:16:52 +0530 Subject: [PATCH] fix #235406: standard keyboard shortcuts missing small changes minor change formatting fixes all shortcuts are now displayed in prefs dialog minor change formatting fix small change changed length to size --- mscore/shortcut.cpp | 19 +++++++++++++++++++ mscore/shortcut.h | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/mscore/shortcut.cpp b/mscore/shortcut.cpp index 2cfe4b5b84cc6..4bf568c83a6a6 100644 --- a/mscore/shortcut.cpp +++ b/mscore/shortcut.cpp @@ -3539,6 +3539,17 @@ void Shortcut::setKeys(const QList& ks) _action->setShortcuts(_keys); } +//--------------------------------------------------------- +// setStandardKey +//--------------------------------------------------------- + +void Shortcut::setStandardKey(QKeySequence::StandardKey k) + { + _standardKey = k; + if (_action && k != QKeySequence::UnknownKey) + _action->setShortcuts(_standardKey); + } + //--------------------------------------------------------- // descr //--------------------------------------------------------- @@ -3669,6 +3680,14 @@ QString Shortcut::keysToString() const s += "; "; s += Shortcut::keySeqToString(_keys[i], QKeySequence::NativeText); } + if (s.isEmpty() && _standardKey != QKeySequence::UnknownKey) { + QList keySeqList = QKeySequence::keyBindings(_standardKey); + for (int i = 0; i < keySeqList.size(); i++) { + if (i) + s += "; "; + s += Shortcut::keySeqToString(keySeqList[i], QKeySequence::NativeText); + } + } return s; } diff --git a/mscore/shortcut.h b/mscore/shortcut.h index 462390eab891d..f393e4b0efc4a 100644 --- a/mscore/shortcut.h +++ b/mscore/shortcut.h @@ -151,7 +151,7 @@ class Shortcut { Icons icon() const { return _icon; } const QList& keys() const { return _keys; } QKeySequence::StandardKey standardKey() const { return _standardKey; } - void setStandardKey(QKeySequence::StandardKey k) { _standardKey = k; } + void setStandardKey(QKeySequence::StandardKey k); void setKeys(const QList& ks); bool compareKeys(const Shortcut&) const;