Enable toggling tags
This commit is contained in:
parent
d8c0d4874b
commit
8d2d8dc267
8 changed files with 73 additions and 15 deletions
|
|
@ -324,6 +324,7 @@ RoomlistModel::initializeRooms()
|
|||
models.clear();
|
||||
roomids.clear();
|
||||
invites.clear();
|
||||
currentRoom_ = nullptr;
|
||||
|
||||
invites = cache::client()->invites();
|
||||
for (const auto &id : invites.keys())
|
||||
|
|
@ -461,6 +462,22 @@ FilteredRoomlistModel::lessThan(const QModelIndex &left, const QModelIndex &righ
|
|||
return left.row() < right.row();
|
||||
}
|
||||
|
||||
bool
|
||||
FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) const
|
||||
{
|
||||
if (filterType == FilterBy::Nothing)
|
||||
return true;
|
||||
else if (filterType == FilterBy::Tag) {
|
||||
auto tags = sourceModel()
|
||||
->data(sourceModel()->index(sourceRow, 0), RoomlistModel::Tags)
|
||||
.toStringList();
|
||||
|
||||
return tags.contains(filterStr);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
FilteredRoomlistModel::FilteredRoomlistModel(RoomlistModel *model, QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
, roomlistmodel(model)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue