QskShortcutMap::setEnabled added

This commit is contained in:
Uwe Rathmann 2020-12-15 17:02:20 +01:00
parent 3004b8b74f
commit e64111bc35
2 changed files with 17 additions and 0 deletions

View File

@ -32,6 +32,7 @@ class QskShortcutHandler final : public QObject
void remove( int id ); void remove( int id );
void setEnabled( int id, bool ); void setEnabled( int id, bool );
void setEnabled( const QKeySequence&, bool on );
void setAutoRepeat( int id, bool repeat ); void setAutoRepeat( int id, bool repeat );
bool eventFilter( QObject*, QEvent* ) override; 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 ) void QskShortcutHandler::setEnabled( int id, bool enabled )
{ {
auto map = qskShortcutMap(); auto map = qskShortcutMap();
@ -328,6 +339,11 @@ void QskShortcutMap::setAutoRepeat( int id, bool on )
qskShortcutHandler->setAutoRepeat( id, on ); qskShortcutHandler->setAutoRepeat( id, on );
} }
void QskShortcutMap::setEnabled( const QKeySequence& sequence, bool on )
{
qskShortcutHandler->setEnabled( sequence, on );
}
void QskShortcutMap::setEnabled( int id, bool on ) void QskShortcutMap::setEnabled( int id, bool on )
{ {
qskShortcutHandler->setEnabled( id, on ); qskShortcutHandler->setEnabled( id, on );

View File

@ -17,6 +17,7 @@ class QSK_EXPORT QskShortcutMap
public: public:
static void setAutoRepeat( int, bool on ); static void setAutoRepeat( int, bool on );
static void setEnabled( int, bool on ); static void setEnabled( int, bool on );
static void setEnabled( const QKeySequence&, bool on );
static void removeShortcut( int ); static void removeShortcut( int );