diff --git a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp index d90c1cad7a..445ac8553f 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp @@ -45,6 +45,7 @@ #include "defaultfeatures/cafCmdAddItemFeature.h" #include +#include namespace caf { @@ -313,4 +314,27 @@ std::vector CmdFeatureManager::commandFeaturesMatchingSubString(con return matches; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector CmdFeatureManager::commandFeaturesMatchingKeyboardShortcut(const QKeySequence& keySequence) const +{ + std::vector matches; + + std::vector keys = CommandFeatureFactory::instance()->allKeys(); + for (size_t i = 0; i < keys.size(); i++) + { + caf::CmdFeature* cmdFeature = commandFeature(keys[i]); + if (cmdFeature) + { + if (cmdFeature->action()->shortcut().matches(keySequence) == QKeySequence::ExactMatch) + { + matches.push_back(cmdFeature); + } + } + } + + return matches; +} + } // end namespace caf diff --git a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h index db3bb6a605..76fe9cc931 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h +++ b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h @@ -45,6 +45,7 @@ #include class QAction; +class QKeySequence; namespace caf { @@ -72,7 +73,7 @@ public: CmdFeature* getCommandFeature(const std::string& commandId); std::vector commandFeaturesMatchingSubString(const std::string& subString) const; - + std::vector commandFeaturesMatchingKeyboardShortcut(const QKeySequence& keySequence) const; private: CmdFeatureManager();