added shortcuts conflicts detection

This commit is contained in:
Luis Ángel San Martín
2014-07-22 22:02:06 +02:00
parent 2712ef89b2
commit eb095bcdaf
8 changed files with 78 additions and 14 deletions

View File

@ -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;
}