diff options
author | Guoqing Zhang <guoqing.zhang@nokia.com> | 2011-03-16 11:29:20 (GMT) |
---|---|---|
committer | Guoqing Zhang <guoqing.zhang@nokia.com> | 2011-03-16 11:29:20 (GMT) |
commit | 39dcac49c9a20eaa9b347276d97547461c3904aa (patch) | |
tree | 8a0cc8574bed910f24438ee0fe5fb961021b3a65 /src/gui/itemviews | |
parent | 82198dd1f7049cec89271b0ea82521752cc13c05 (diff) | |
parent | e318b0276c3d4a0db8660b4fa6d68f1784aee522 (diff) | |
download | Qt-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.cpp | 14 |
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) |