diff options
author | Thorbjørn Martsum <tmartsum@gmail.com> | 2013-08-26 12:14:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-02 16:26:21 +0200 |
commit | 0bcfa3d5d9d67912e1d7d62e6d15acedb98cabd9 (patch) | |
tree | 0ac1b925d96b9f50e89b7d601c6dc96b856e504e /tests/auto/widgets/itemviews | |
parent | 8f4b6f1cd166986f219e72a584fe19379880c2c5 (diff) |
QHeaderView - add maximum section size
When we auto resize it is handy to be able to limit the maximum
size (just like the minimum size).
[ChangeLog][QtWidgets][QHeaderView]A maximumSize for sections
has been introduced. The maximum section size is by default
the largest possible section size which in Qt 5.2 has been
limited to 1048575 pixels.
Task-number: QTBUG-4346
Change-Id: Ida9cbcc11bd5c4498e319df2e6379c69a7033c04
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/widgets/itemviews')
-rw-r--r-- | tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 09f0161dff..398b1b4d98 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -2721,6 +2721,20 @@ void tst_QHeaderView::resizeToContentTest() QVERIFY(view->sectionSize(1) > 1); QVERIFY(view->sectionSize(2) > 1); + // Check minimum section size + hh->setMinimumSectionSize(150); + model->setData(idx, QVariant("i")); + hh->resizeSections(QHeaderView::ResizeToContents); + QCOMPARE(hh->sectionSize(3), 150); + hh->setMinimumSectionSize(-1); + + // Check maximumSection size + hh->setMaximumSectionSize(200); + model->setData(idx, QVariant("This is a even longer string that is expected to be more than 200 pixels")); + hh->resizeSections(QHeaderView::ResizeToContents); + QCOMPARE(hh->sectionSize(3), 200); + hh->setMaximumSectionSize(-1); + view->setDefaultSectionSize(25); // To make sure our precalced data are correct. We do not know font height etc. const int precalced_results[] = { -1523279360, -1523279360, -1347156568, 1, 1719705216, 1719705216, 12500 }; |