diff options
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidgetItem.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidgetItem.h | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp index 1f2964e..0b90c54 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp @@ -12,8 +12,10 @@ QtTreeWidgetItem::QtTreeWidgetItem(QtTreeWidgetItem* parentItem) : QObject(), te expanded_ = true; } + void QtTreeWidgetItem::setText(const String& text) { displayName_ = P2QSTRING(text); + displayNameLower_ = displayName_.toLower(); emit changed(this); } @@ -216,12 +218,12 @@ bool QtTreeWidgetItem::operator<(const QtTreeWidgetItem& item) const { if (!item.isContact()) { return false; } - return getStatusShow() == item.getStatusShow() ? getName().toLower() < item.getName().toLower() : getStatusShow() < item.getStatusShow(); + return getStatusShow() == item.getStatusShow() ? getLowerName() < item.getLowerName() : getStatusShow() < item.getStatusShow(); } else { if (item.isContact()) { return true; } - return getName().toLower() < item.getName().toLower(); + return getLowerName() < item.getLowerName(); } } diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.h b/Swift/QtUI/Roster/QtTreeWidgetItem.h index 407bc9a..d243115 100644 --- a/Swift/QtUI/Roster/QtTreeWidgetItem.h +++ b/Swift/QtUI/Roster/QtTreeWidgetItem.h @@ -50,7 +50,8 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem { bool isShown(); bool isContact() const; bool isExpanded(); - QString getName() const {return displayName_;}; + const QString& getName() const {return displayName_;}; + const QString& getLowerName() const {return displayNameLower_;}; StatusShow::Type getStatusShow() const {return statusShowType_;}; QWidget* getCollapsedRosterWidget(); @@ -67,6 +68,7 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem { QList<QtTreeWidgetItem*> shownChildren_; QtTreeWidgetItem* parent_; QString displayName_; + QString displayNameLower_; QString statusText_; QColor textColor_; QColor backgroundColor_; |