diff options
-rw-r--r-- | examples/widgets/widgets/shortcuteditor/shortcuteditormodel.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.cpp b/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.cpp index 4355f029e1..612f1fb726 100644 --- a/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.cpp +++ b/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.cpp @@ -257,11 +257,11 @@ bool ShortcutEditorModel::setData(const QModelIndex &index, const QVariant &valu QString keySequenceString = value.toString(); ShortcutEditorModelItem *item = static_cast<ShortcutEditorModelItem *>(index.internalPointer()); QAction *itemAction = item->action(); - if (itemAction - && keySequenceString == itemAction->shortcut().toString(QKeySequence::NativeText)) - return true; - - itemAction->setShortcut(keySequenceString); + if (itemAction) { + if (keySequenceString == itemAction->shortcut().toString(QKeySequence::NativeText)) + return true; + itemAction->setShortcut(keySequenceString); + } Q_EMIT dataChanged(index, index); if (keySequenceString.isEmpty()) |