From f633bc7f7fb72ba261b46e979603376f0016c085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Martsum?= Date: Wed, 7 Aug 2013 08:15:58 +0200 Subject: QHeaderView - reduce memory usage Though the worst case memory usage was improved in b800d8b94a7861ecf8853621f6556fca186fb5b7 the best case usage changed. Since best case is the same as worst case in Qt5, we should use as little as possible, which this patch ensures. We reduce the memory usage from 3 to 2 ints per section - which is half of worst case in Qt4. There seems to be no bigger cost in performance doing that. The recalcSectionStartPos is still very fast. This patch limits the maximum section size to (2^20) ~ 1.000.000 pixels. This alleviates Task-number: QTBUG-32325 Change-Id: I9b7530030a31b4e35cf1ca9e32c6b936f5ea9790 Reviewed-by: Stephen Kelly --- tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index fa67e16db9..ba3a150154 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -341,8 +341,8 @@ void tst_QHeaderView::getSetCheck() QVERIFY(obj1.defaultSectionSize() >= 0); obj1.setDefaultSectionSize(0); QCOMPARE(0, obj1.defaultSectionSize()); - obj1.setDefaultSectionSize(INT_MAX); - QCOMPARE(INT_MAX, obj1.defaultSectionSize()); + obj1.setDefaultSectionSize(99999); + QCOMPARE(99999, obj1.defaultSectionSize()); // int QHeaderView::minimumSectionSize() // void QHeaderView::setMinimumSectionSize(int) @@ -350,8 +350,8 @@ void tst_QHeaderView::getSetCheck() QVERIFY(obj1.minimumSectionSize() >= 0); obj1.setMinimumSectionSize(0); QCOMPARE(0, obj1.minimumSectionSize()); - obj1.setMinimumSectionSize(INT_MAX); - QCOMPARE(INT_MAX, obj1.minimumSectionSize()); + obj1.setMinimumSectionSize(99999); + QCOMPARE(99999, obj1.minimumSectionSize()); // int QHeaderView::offset() // void QHeaderView::setOffset(int) -- cgit v1.2.3