summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qheaderview.cpp
diff options
context:
space:
mode:
authorEckhart Koppen <eckhart.koppen@nokia.com>2011-11-16 09:47:45 +0200
committerQt by Nokia <qt-info@nokia.com>2011-11-16 09:08:07 +0100
commitf109f5b8a9c7e6939dfd6c6f72a3b67548f5483c (patch)
tree0f40dc245f835efa9e21f256fdb816edb52bdfd6 /src/widgets/itemviews/qheaderview.cpp
parent18affc8c0aa5180e9538713bbe9d415c3b08f7b7 (diff)
Fix Q_ASSERT usage in case -force-asserts is enabled
Certain Q_ASSERT usages are not compiling with -force-asserts since they are checking for instance variables or other items which are not available in release mode. This fix guards the asserts to only be enabled in debug mode. Change-Id: I2ed74e3d5118608361e8c924e93d8ff0efdc8eab Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets/itemviews/qheaderview.cpp')
-rw-r--r--src/widgets/itemviews/qheaderview.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index aee39a5ea1..2ad75b7263 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -3115,12 +3115,16 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
sectionSpans[i].resizeMode = mode;
// ### check if we can merge the section with any of its neighbours
removeSpans(spansToRemove);
+#ifndef QT_NO_DEBUG
Q_ASSERT(initial_section_count == headerSectionCount());
+#endif
return;
} else if (start > start_section && end < end_section) {
if (sectionSpans.at(i).sectionSize() == span.sectionSize()
&& sectionSpans.at(i).resizeMode == span.resizeMode) {
+#ifndef QT_NO_DEBUG
Q_ASSERT(initial_section_count == headerSectionCount());
+#endif
return;
}
// the new span is in the middle of the old span, so we have to split it
@@ -3149,9 +3153,13 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
int last_span_size = section_size * last_span_count;
sectionSpans.insert(i + 2, SectionSpan(last_span_size, last_span_count, span_mode));
length += last_span_size;
+#ifndef QT_NO_DEBUG
Q_ASSERT(span_count == first_span_count + mid_span_count + last_span_count);
+#endif
removeSpans(spansToRemove);
+#ifndef QT_NO_DEBUG
Q_ASSERT(initial_section_count == headerSectionCount());
+#endif
return;
} else if (start > start_section && start <= end_section && end >= end_section) {
// the new span covers the last part of the existing span
@@ -3167,7 +3175,9 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
sectionSpans.insert(i + 1, span); // insert after
length += span.size;
removeSpans(spansToRemove);
+#ifndef QT_NO_DEBUG
Q_ASSERT(initial_section_count == headerSectionCount());
+#endif
return;
}
} else if (end < end_section && end >= start_section && start <= start_section) {
@@ -3183,7 +3193,9 @@ void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeader
sectionSpans.insert(i, span); // insert before
length += span.size;
removeSpans(spansToRemove);
+#ifndef QT_NO_DEBUG
Q_ASSERT(initial_section_count == headerSectionCount());
+#endif
return;
}
start_section += section_count;