diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-08-31 14:57:11 +1000 |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-08-31 14:57:11 +1000 |
commit | 7c2207640a65dc59a420ebf71a45e38350840313 (patch) | |
tree | 9eb43fa3b92043326a75c0916fc9e7e4454befd2 | |
parent | 19d2736f143dd9272c4d68c633a574ea059ed19c (diff) |
Return early when from == to in move(from, to).
-rw-r--r-- | qobjectlistmodel.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/qobjectlistmodel.cpp b/qobjectlistmodel.cpp index 92b4646..0ac41d7 100644 --- a/qobjectlistmodel.cpp +++ b/qobjectlistmodel.cpp @@ -228,7 +228,8 @@ void QObjectListModel::replace(int i, QObject *object) void QObjectListModel::move(int from, int to) { - beginMoveRows(QModelIndex(), from, from, QModelIndex(), to > from ? to+1 : to); + if (!beginMoveRows(QModelIndex(), from, from, QModelIndex(), to > from ? to+1 : to)) + return; //should only be triggered for our simple case if from == to. m_objects.move(from, to); endMoveRows(); } |