aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmllistmodel.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-08-23 13:37:03 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-09-12 09:07:30 +0000
commit13a1e8239675bbe5a8e6aa90c07a13024171a5dd (patch)
tree653edd67d3062b8f2d91893ecb5c0f6e6fb4608f /src/qml/types/qqmllistmodel.cpp
parente5e044200e99d0505bf6f088e34a75d5d4f48c76 (diff)
QmlListModel: micro optimization
Do not calculate roleIndex if elementIndex is not valid Change-Id: Id3c892664c5a6c566bea75d54b7b1690ec3d8686 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/types/qqmllistmodel.cpp')
-rw-r--r--src/qml/types/qqmllistmodel.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index f7fdbf0d80..2786c9c1e4 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -1505,14 +1505,14 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index)
}
int elementIndex = parentModel->m_modelObjects.indexOf(m_owner);
- int roleIndex = parentModel->m_roles.indexOf(QString::fromLatin1(name(index).constData()));
-
- if (elementIndex != -1 && roleIndex != -1) {
-
- QVector<int> roles;
- roles << roleIndex;
+ if (elementIndex != -1) {
+ int roleIndex = parentModel->m_roles.indexOf(QString::fromLatin1(name(index).constData()));
+ if (roleIndex != -1) {
+ QVector<int> roles;
+ roles << roleIndex;
- parentModel->emitItemsChanged(elementIndex, 1, roles);
+ parentModel->emitItemsChanged(elementIndex, 1, roles);
+ }
}
}