diff options
author | Luca Beldi <v.ronin@yahoo.it> | 2021-04-23 15:35:29 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-26 17:47:57 +0000 |
commit | 45ebdae164a68a31212d782c485600a4ec4ad051 (patch) | |
tree | 2d323017603575d1e5ee8dfa8f5d7cf66ffdaf2f /src/testlib | |
parent | 28b57d70d239193dcdff98e79c8a24110adbbde0 (diff) |
Fix QAbstractItemModelTester false positive
When inserting rows to a branch with no columns
the tester should not complain about indexes being invalid
Change-Id: I466f4e5140b10f6dcf65a71f109c2d3be7336507
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit fcea8e7aa8a65de9e80136c2d603478831b246d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qabstractitemmodeltester.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/testlib/qabstractitemmodeltester.cpp b/src/testlib/qabstractitemmodeltester.cpp index abb4ff7c60..ec7f43b5a4 100644 --- a/src/testlib/qabstractitemmodeltester.cpp +++ b/src/testlib/qabstractitemmodeltester.cpp @@ -455,7 +455,7 @@ void QAbstractItemModelTesterPrivate::parent() // Common error test #2, make sure that a second level index has a parent // that is the first level index. - if (model->rowCount(topIndex) > 0) { + if (model->rowCount(topIndex) > 0 && model->columnCount(topIndex) > 0) { QModelIndex childIndex = model->index(0, 0, topIndex); MODELTESTER_VERIFY(childIndex.isValid()); MODELTESTER_COMPARE(model->parent(childIndex), topIndex); |