#include "roomlistsortmodel.h"
#include "room.h"
#include "roomlistmodel.h"
#include "membermodel.h"
bool RoomListSortModel::lessThan(const QModelIndex& left, const QModelIndex& right) const {
const QString sectionLeft = sourceModel()->data(left, RoomListModel::SectionRole).toString();
const QString sectionRight = sourceModel()->data(right, RoomListModel::SectionRole).toString();
if(sectionRight == "Direct Chats")
return false;
if(sectionLeft == "Direct Chats")
return true;
}
bool MemberListSortModel::lessThan(const QModelIndex& left, const QModelIndex& right) const {
const QString sectionLeft = sourceModel()->data(left, MemberModel::SectionRole).toString();
const QString sectionRight = sourceModel()->data(right, MemberModel::SectionRole).toString();
if(sectionLeft == "Admin" && sectionRight == "Moderator")
else if(sectionLeft == "Moderator" && sectionRight == "User")
else if(sectionLeft == "Admin" && sectionRight == "User")
if(sectionLeft == sectionRight)
return sourceModel()->data(left, MemberModel::DisplayNameRole).toString() < sourceModel()->data(right, MemberModel::DisplayNameRole).toString();