diff --git a/models/ShortcutEditorModel.cpp b/models/ShortcutEditorModel.cpp index f28548b6..69c66a58 100644 --- a/models/ShortcutEditorModel.cpp +++ b/models/ShortcutEditorModel.cpp @@ -82,7 +82,7 @@ bool ShortcutEditorModel::setData(const QModelIndex &index, const QVariant &valu return false; } - if ( findShortcut(actionList, newShortcutString) ) + if ( findShortcut(actionList, action, newShortcutString) ) { emit conflictDetected(tr("Conflict with a user-defined shortcut")); return false; @@ -109,11 +109,13 @@ Qt::ItemFlags ShortcutEditorModel::flags(const QModelIndex &index) const } const QAction *ShortcutEditorModel::findShortcut(const QList &list, - const QString &shortcut) + const QAction *currAction, + const QString &shortcut) const { for ( const QAction* action : list ) { - if ( action->shortcut().toString(QKeySequence::NativeText) == shortcut ) + if ( action->shortcut().toString(QKeySequence::NativeText) == shortcut + && action != currAction ) return action; } diff --git a/models/ShortcutEditorModel.h b/models/ShortcutEditorModel.h index b5208762..ed1d67c5 100644 --- a/models/ShortcutEditorModel.h +++ b/models/ShortcutEditorModel.h @@ -32,7 +32,8 @@ class ShortcutEditorModel : public QAbstractTableModel QStringList builtInStaticActionList; const QAction *findShortcut(const QList &list, - const QString&); + const QAction *currAction, + const QString&) const; }; #endif // SHORTCUTEDITORMODEL_H