QHeaderView 5.0 - no emit of sortIndicatorChanged when unchanged
authorThorbjørn Lund Martsum <tmartsum@gmail.com>
Thu, 25 Oct 2012 04:49:20 +0000 (06:49 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 26 Oct 2012 13:23:46 +0000 (15:23 +0200)
There is no reason to emit this when there is no change.

Change-Id: I34f0ceec7c4b0959b77bc5be3ce2c2ad55864598
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
dist/changes-5.0.0
src/widgets/itemviews/qheaderview.cpp

index 4c7cebf..5a32b46 100644 (file)
@@ -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
index 08f10de..e7e3a58 100644 (file)
@@ -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;