diff options
author | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2012-11-09 15:58:57 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-15 13:55:00 +0100 |
commit | fc271b4273c7ebfe2d08a6a29ec99c2f13ebb8cd (patch) | |
tree | 2e2a8abb00fe2f1925e295b9ebd6f8c61f527aa3 /tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | |
parent | 46fe591a534d85090ff94136598a9272f1e0c20a (diff) |
Regression fix to QHeaderView::setDefaultSectionSize
When the sections has been resized we need to calculate new values
for the section start-positions. Otherwise we break visualIndexAt
and sectionPosition.
This fixes a regression introduced in
b800d8b94a7861ecf8853621f6556fca186fb5b7
Change-Id: I148dbf44f742208787ed59b70d82b8048d721e90
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp')
-rw-r--r-- | tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 844c66432e..e6181158fe 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -1637,9 +1637,15 @@ void tst_QHeaderView::defaultSectionSizeTest() { // Setup QTableView qtv; + QHeaderView *hv = qtv.verticalHeader(); + hv->setDefaultSectionSize(99); // Set it to a value different from defaultSize. QStandardItemModel amodel(4, 4); qtv.setModel(&amodel); - QHeaderView *hv = qtv.verticalHeader(); + QCOMPARE(hv->sectionSize(0), 99); + QCOMPARE(hv->visualIndexAt(50), 0); // <= also make sure that indexes are calculated + hv->setDefaultSectionSize(40); // Set it to a value different from defaultSize. + QCOMPARE(hv->visualIndexAt(50), 1); + const int defaultSize = 26; hv->setDefaultSectionSize(defaultSize + 1); // Set it to a value different from defaultSize. |