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 | |
parent | 3ee8ed658aca3f478490afecda732f9f79165e4c (diff) | |
download | swift-356a2f03e8c7e4cc1b2852fc7b530357c3213787.zip swift-356a2f03e8c7e4cc1b2852fc7b530357c3213787.tar.bz2 |
Roster rendering of the test down from 2:11 to 0:10 on my desktop
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidgetItem.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidgetItem.h | 2 |
2 files changed, 7 insertions, 5 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; +} } diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.h b/Swift/QtUI/Roster/QtTreeWidgetItem.h index d243115..4f4e28f 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.h +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.h @@ -78,7 +78,7 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem { StatusShow::Type statusShowType_; }; -//bool itemLessThan(const QtTreeWidgetItem& left, const QtTreeWidgetItem& right); +bool itemLessThan(QtTreeWidgetItem* left, QtTreeWidgetItem* right); } #endif |