summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorGuoqing Zhang <guoqing.zhang@nokia.com>2011-03-16 11:29:20 (GMT)
committerGuoqing Zhang <guoqing.zhang@nokia.com>2011-03-16 11:29:20 (GMT)
commit39dcac49c9a20eaa9b347276d97547461c3904aa (patch)
tree8a0cc8574bed910f24438ee0fe5fb961021b3a65 /src/gui/itemviews
parent82198dd1f7049cec89271b0ea82521752cc13c05 (diff)
parente318b0276c3d4a0db8660b4fa6d68f1784aee522 (diff)
downloadQt-39dcac49c9a20eaa9b347276d97547461c3904aa.zip
Qt-39dcac49c9a20eaa9b347276d97547461c3904aa.tar.gz
Qt-39dcac49c9a20eaa9b347276d97547461c3904aa.tar.bz2
Merge remote branch 'qt-master/master'
Conflicts: src/corelib/thread/qthread_unix.cpp
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qheaderview.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 6359f0b..d6d9536 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -3274,9 +3274,17 @@ void QHeaderViewPrivate::clear()
void QHeaderViewPrivate::flipSortIndicator(int section)
{
Q_Q(QHeaderView);
- bool ascending = (sortIndicatorSection != section
- || sortIndicatorOrder == Qt::DescendingOrder);
- q->setSortIndicator(section, ascending ? Qt::AscendingOrder : Qt::DescendingOrder);
+ Qt::SortOrder sortOrder;
+ if (sortIndicatorSection == section) {
+ sortOrder = (sortIndicatorOrder == Qt::DescendingOrder) ? Qt::AscendingOrder : Qt::DescendingOrder;
+ } else {
+ const QVariant value = model->headerData(section, orientation, Qt::InitialSortOrderRole);
+ if (value.canConvert(QVariant::Int))
+ sortOrder = static_cast<Qt::SortOrder>(value.toInt());
+ else
+ sortOrder = Qt::AscendingOrder;
+ }
+ q->setSortIndicator(section, sortOrder);
}
void QHeaderViewPrivate::cascadingResize(int visual, int newSize)