diff options
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; +} } |