From f151424797794cba5a3fdaf628eabaa75a5e7801 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Wed, 14 Oct 2009 11:30:43 +0200 Subject: Make the autotest pass for descending order in QTableWidget It failed after this commit: 19030e2af098e319e3c3f3883c51e28364bf3ccf Reviewed-by: ogoffart --- src/gui/itemviews/qtablewidget.cpp | 2 +- src/gui/itemviews/qtreewidget.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp index 65758b8..21c4e0a 100644 --- a/src/gui/itemviews/qtablewidget.cpp +++ b/src/gui/itemviews/qtablewidget.cpp @@ -571,7 +571,7 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order, colItems.remove(oldRow); vit = sortedInsertionIterator(vit, colItems.end(), order, item); int newRow = qMax((int)(vit - colItems.begin()), 0); - if ((newRow < oldRow) && !(*item < *colItems.at(oldRow - 1))) + if ((newRow < oldRow) && !(*item < *colItems.at(oldRow - 1)) && !(*colItems.at(oldRow - 1) < *item)) newRow = oldRow; vit = colItems.insert(vit, item); if (newRow != oldRow) { diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 06342d8..040c498 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -623,7 +623,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order, lit = sortedInsertionIterator(lit, lst.end(), order, item); int newRow = qMax(lit - lst.begin(), 0); - if ((newRow < oldRow) && !(*item < *lst.at(oldRow - 1))) + if ((newRow < oldRow) && !(*item < *lst.at(oldRow - 1)) && !(*lst.at(oldRow - 1) < *item )) newRow = oldRow; lit = lst.insert(lit, item); -- cgit v0.12