aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-11-04 12:34:56 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-11-04 13:06:55 +0100
commitbdc14837191dc81452fa7fbba20ba0a29e5fbebd (patch)
treef4b763d9e84083773eab7f989d8bdf99540219d5 /tests/auto
parent67ae5055366b7397ee282b1ddc77e3a9e8f12d17 (diff)
Fix QQuickHeaderView models to pass model tester
Following 72e0d699cec09458ca9325035d477d4899e8e47b in qtbase, the model tester exercises additional code paths to verify correct row/columnCount implementations for flat models. This revealed a few bugs in the models used in QQuickHeaderView and the unit test: * neither QHeaderDataProxyModel nor the test models handled a valid parent index for calls to row/columnCount * QHeaderDataProxyModel::sibling passed the index on as parent Change-Id: I612e18030d837275614d61ce8987c93fff7f20a9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qquickheaderview/tst_qquickheaderview.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/auto/qquickheaderview/tst_qquickheaderview.cpp b/tests/auto/qquickheaderview/tst_qquickheaderview.cpp
index d8d71183..14e0bb79 100644
--- a/tests/auto/qquickheaderview/tst_qquickheaderview.cpp
+++ b/tests/auto/qquickheaderview/tst_qquickheaderview.cpp
@@ -58,8 +58,10 @@ public:
{
}
- int rowCount(const QModelIndex & = QModelIndex()) const override
+ int rowCount(const QModelIndex &index = QModelIndex()) const override
{
+ if (index.isValid())
+ return 0;
return m_rows;
}
virtual void setRowCount(int count)
@@ -70,8 +72,10 @@ public:
endResetModel();
}
- int columnCount(const QModelIndex & = QModelIndex()) const override
+ int columnCount(const QModelIndex &index = QModelIndex()) const override
{
+ if (index.isValid())
+ return 0;
return m_cols;
}
virtual void setColumnCount(int count)