From 4fbdb969fb4e446eab01f27eb2c880f8d6cb9106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Thu, 25 Oct 2012 06:49:20 +0200 Subject: [PATCH] QHeaderView 5.0 - no emit of sortIndicatorChanged when unchanged There is no reason to emit this when there is no change. Change-Id: I34f0ceec7c4b0959b77bc5be3ce2c2ad55864598 Reviewed-by: Stephen Kelly --- dist/changes-5.0.0 | 2 ++ src/widgets/itemviews/qheaderview.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index 4c7cebfa8e..5a32b46a17 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -566,6 +566,8 @@ QtWidgets * ResizeMode resizeMode(int logicalindex) const - use sectionResizeMode(int logicalindex) instead. + * setSortIndicator will no longer emit sortIndicatorChanged when the sort indicator is unchanged. + * QDateEdit and QTimeEdit have re-gained a USER property. These were originally removed before Qt 4.7.0, and are re-added for 5.0. This means that the userProperty for those classes are now QDate and QTime respectively, not QDateTime as they have been diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 08f10defb8..e7e3a58670 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -1349,6 +1349,8 @@ void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order) // This is so that people can set the position of the sort indicator before the fill the model int old = d->sortIndicatorSection; + if (old == logicalIndex && order == d->sortIndicatorOrder) + return; d->sortIndicatorSection = logicalIndex; d->sortIndicatorOrder = order;