diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-03-30 07:49:03 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-03-30 07:49:03 (GMT) |
commit | 356a2f03e8c7e4cc1b2852fc7b530357c3213787 (patch) | |
tree | 7b99aad8952b6cfcdf97a19e4361034447c171a6 /Swift/QtUI/Roster/QtTreeWidgetItem.cpp | |
parent | 3ee8ed658aca3f478490afecda732f9f79165e4c (diff) | |
download | swift-contrib-356a2f03e8c7e4cc1b2852fc7b530357c3213787.zip swift-contrib-356a2f03e8c7e4cc1b2852fc7b530357c3213787.tar.bz2 |
Roster rendering of the test down from 2:11 to 0:10 on my desktop
Diffstat (limited to 'Swift/QtUI/Roster/QtTreeWidgetItem.cpp')
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidgetItem.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp index 0b90c54..5bd7d1e 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp @@ -3,6 +3,7 @@ #include <qdebug.h> #include <QtAlgorithms> +#include <algorithm> namespace Swift { @@ -140,7 +141,8 @@ void bubbleSort(QList<QtTreeWidgetItem*>& list) { void QtTreeWidgetItem::handleChanged(QtTreeWidgetItem* child) { /*We don't use the much faster qStableSort because it causes changed(child) and all sorts of nasty recursion*/ //qStableSort(children_.begin(), children_.end(), itemLessThan); - bubbleSort(children_); + //bubbleSort(children_); + std::stable_sort(children_.begin(), children_.end(), itemLessThan); shownChildren_.clear(); for (int i = 0; i < children_.size(); i++) { if (children_[i]->isShown()) { @@ -227,8 +229,8 @@ bool QtTreeWidgetItem::operator<(const QtTreeWidgetItem& item) const { } } -//bool itemLessThan(const QtTreeWidgetItem& left, const QtTreeWidgetItem& right) { -// return left < right; -//} +bool itemLessThan(QtTreeWidgetItem* left, QtTreeWidgetItem* right) { + return *left < *right; +} } |