diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /src/corelib/itemmodels/qstringlistmodel.cpp | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'src/corelib/itemmodels/qstringlistmodel.cpp')
-rw-r--r-- | src/corelib/itemmodels/qstringlistmodel.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index 3cc0bee8ef..a248cdcd38 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -220,7 +220,10 @@ bool QStringListModel::setData(const QModelIndex &index, const QVariant &value, { if (index.row() >= 0 && index.row() < lst.size() && (role == Qt::EditRole || role == Qt::DisplayRole)) { - lst.replace(index.row(), value.toString()); + const QString valueString = value.toString(); + if (lst.at(index.row()) == valueString) + return true; + lst.replace(index.row(), valueString); emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole}); return true; } @@ -230,6 +233,7 @@ bool QStringListModel::setData(const QModelIndex &index, const QVariant &value, #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) /*! \reimp + \since 6.0 */ bool QStringListModel::clearItemData(const QModelIndex &index) { |