summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.cpp10
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.h2
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