changed sort to case insensitive in peers tree

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3113 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-06-11 23:28:05 +00:00
parent c3c607ec80
commit b715a577b0

View File

@ -101,12 +101,22 @@ public:
bool operator<(const QTreeWidgetItem &other) const bool operator<(const QTreeWidgetItem &other) const
{ {
int role = Qt::DisplayRole;
int column = m_pWidget ? m_pWidget->sortColumn() : 0; int column = m_pWidget ? m_pWidget->sortColumn() : 0;
if (column == COLUMN_STATE) {
// sort by state set in user role switch (column) {
const QVariant v1 = data(column, Qt::UserRole); case COLUMN_STATE:
const QVariant v2 = other.data(column, Qt::UserRole); // sort by state set in user role
return v1.toString() < v2.toString(); role = Qt::UserRole;
// no break;
case COLUMN_NAME:
{
const QVariant v1 = data(column, role);
const QVariant v2 = other.data(column, role);
return (v1.toString().compare (v2.toString(), Qt::CaseInsensitive) < 0);
}
} }
// let the standard do the sort // let the standard do the sort