diff --git a/src/controls/QskShortcutMap.cpp b/src/controls/QskShortcutMap.cpp index 538ebbfb..27f5a07e 100644 --- a/src/controls/QskShortcutMap.cpp +++ b/src/controls/QskShortcutMap.cpp @@ -32,6 +32,7 @@ class QskShortcutHandler final : public QObject void remove( int id ); void setEnabled( int id, bool ); + void setEnabled( const QKeySequence&, bool on ); void setAutoRepeat( int id, bool repeat ); bool eventFilter( QObject*, QEvent* ) override; @@ -217,6 +218,16 @@ void QskShortcutHandler::cleanUp( QObject* object ) } } +void QskShortcutHandler::setEnabled( const QKeySequence& sequence, bool on ) +{ + for ( auto it = m_invokeDataMap.begin(); + it != m_invokeDataMap.end(); ++it ) + { + if ( it->second.sequence == sequence ) + setEnabled( it->first, on ); + } +} + void QskShortcutHandler::setEnabled( int id, bool enabled ) { auto map = qskShortcutMap(); @@ -328,6 +339,11 @@ void QskShortcutMap::setAutoRepeat( int id, bool on ) qskShortcutHandler->setAutoRepeat( id, on ); } +void QskShortcutMap::setEnabled( const QKeySequence& sequence, bool on ) +{ + qskShortcutHandler->setEnabled( sequence, on ); +} + void QskShortcutMap::setEnabled( int id, bool on ) { qskShortcutHandler->setEnabled( id, on ); diff --git a/src/controls/QskShortcutMap.h b/src/controls/QskShortcutMap.h index 8cc352ee..edd88044 100644 --- a/src/controls/QskShortcutMap.h +++ b/src/controls/QskShortcutMap.h @@ -17,6 +17,7 @@ class QSK_EXPORT QskShortcutMap public: static void setAutoRepeat( int, bool on ); static void setEnabled( int, bool on ); + static void setEnabled( const QKeySequence&, bool on ); static void removeShortcut( int );