diff --git a/src/blackmisc/input/actionhotkeylist.cpp b/src/blackmisc/input/actionhotkeylist.cpp index fc9c2f9d6..167429dd9 100644 --- a/src/blackmisc/input/actionhotkeylist.cpp +++ b/src/blackmisc/input/actionhotkeylist.cpp @@ -20,7 +20,7 @@ namespace BlackMisc CSequence(baseClass) { } - CActionHotkeyList CActionHotkeyList::findSubsetsOf(const CActionHotkey &other) + CActionHotkeyList CActionHotkeyList::findSubsetsOf(const CActionHotkey &other) const { CActionHotkeyList subsets; for (const auto &actionHotkey : *this) @@ -33,7 +33,7 @@ namespace BlackMisc return subsets; } - CActionHotkeyList CActionHotkeyList::findSupersetsOf(const CActionHotkey &other) + CActionHotkeyList CActionHotkeyList::findSupersetsOf(const CActionHotkey &other) const { CActionHotkeyList supersets; for (const auto &actionHotkey : *this) @@ -45,5 +45,10 @@ namespace BlackMisc } return supersets; } - } -} + + bool CActionHotkeyList::containsAction(const QString &action) const + { + return this->contains(&CActionHotkey::getAction, action); + } + } // ns +} // ns diff --git a/src/blackmisc/input/actionhotkeylist.h b/src/blackmisc/input/actionhotkeylist.h index fe8ecb4a8..421b4b380 100644 --- a/src/blackmisc/input/actionhotkeylist.h +++ b/src/blackmisc/input/actionhotkeylist.h @@ -47,16 +47,18 @@ namespace BlackMisc //! Returns true if this list has a action hotkey with a combination which is a subset of other //! Example: //! List contains CTRL and other has combination CTRL-F - CActionHotkeyList findSubsetsOf(const CActionHotkey &other); + CActionHotkeyList findSubsetsOf(const CActionHotkey &other) const; //! Returns true if this list has a hotkey with a combination for which other is a subset //! Example: //! List contains CTRL-F and other has combination CTRL - CActionHotkeyList findSupersetsOf(const CActionHotkey &other); - }; + CActionHotkeyList findSupersetsOf(const CActionHotkey &other) const; - } -} // namespace + //! Contains action + bool containsAction(const QString &action) const; + }; + } // ns +} // ns Q_DECLARE_METATYPE(BlackMisc::Input::CActionHotkeyList) Q_DECLARE_METATYPE(BlackMisc::CCollection)