mirror of
https://github.com/YACReader/yacreader
synced 2025-07-21 06:24:39 -04:00
added shortcuts conflicts detection
This commit is contained in:
@ -93,3 +93,20 @@ void ShortcutsManager::saveShortcut(QAction *action)
|
||||
|
||||
return s.setValue(action->data().toString() , action->shortcut().toString());
|
||||
}
|
||||
|
||||
void ShortcutsManager::registerActions(const QList<QAction *> &a)
|
||||
{
|
||||
actions = a;
|
||||
}
|
||||
|
||||
bool ShortcutsManager::checkConflicts(const QKeySequence & shortcut, const QAction *dest)
|
||||
{
|
||||
foreach(QAction * action, actions)
|
||||
{
|
||||
if(action != dest) //if the same shortcut is setted there is no conflict
|
||||
if(action->shortcut() == shortcut)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user