From e500946de964649b03fa9d73dd98e58a973bc956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Mon, 27 Feb 2012 10:56:42 +0100 Subject: QHeaderView - remove sectionCount variable A previous patch ensures that we have exactly one section in a Span. ( see SHA : b800d8b94a7861ecf8853621f6556fca186fb5b7 ) Therefore we no longer need the sectionCount variable. We have assess to it through the sectionSpan.count. To keep this patch quite simple the variable sectionCount has been changed to a function returning the count value. Change-Id: Ibc419eafa38ab64b08f93074cb6ae4b8518995f6 Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qheaderview_p.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/widgets/itemviews/qheaderview_p.h') diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h index 2c657221dd..a2b0ef2180 100644 --- a/src/widgets/itemviews/qheaderview_p.h +++ b/src/widgets/itemviews/qheaderview_p.h @@ -84,7 +84,6 @@ public: pressed(-1), hover(-1), length(0), - sectionCount(0), movableSections(false), clickableSections(false), highlightSelected(false), @@ -137,11 +136,13 @@ public: inline void prepareSectionSelected() { if (!selectionModel || !selectionModel->hasSelection()) sectionSelected.clear(); - else if (sectionSelected.count() != sectionCount * 2) - sectionSelected.fill(false, sectionCount * 2); + else if (sectionSelected.count() != sectionCount() * 2) + sectionSelected.fill(false, sectionCount() * 2); else sectionSelected.fill(false); } + inline int sectionCount() const {return sectionSpans.count();} + inline bool reverse() const { return orientation == Qt::Horizontal && q_func()->isRightToLeft(); } @@ -182,11 +183,11 @@ public: } inline void initializeIndexMapping() const { - if (visualIndices.count() != sectionCount - || logicalIndices.count() != sectionCount) { - visualIndices.resize(sectionCount); - logicalIndices.resize(sectionCount); - for (int s = 0; s < sectionCount; ++s) { + if (visualIndices.count() != sectionCount() + || logicalIndices.count() != sectionCount()) { + visualIndices.resize(sectionCount()); + logicalIndices.resize(sectionCount()); + for (int s = 0; s < sectionCount(); ++s) { visualIndices[s] = s; logicalIndices[s] = s; } @@ -194,7 +195,7 @@ public: } inline void clearCascadingSections() { - firstCascadingSection = sectionCount; + firstCascadingSection = sectionSpans.count(); lastCascadingSection = 0; cascadingSectionSize.clear(); } @@ -265,7 +266,6 @@ public: int hover; int length; - int sectionCount; bool movableSections; bool clickableSections; bool highlightSelected; -- cgit v1.2.3