10#include <QRegularExpression>
28 endFilterChange (Direction::Rows);
34 Separator_ = separator;
35 endFilterChange (Direction::Rows);
42 endFilterChange (Direction::Rows);
49 endFilterChange (Direction::Rows);
55 for (
const auto& s : QStringView {
string }.split (Separator_, Qt::SkipEmptyParts))
56 FilterTags_ << s.trimmed ().toString ();
64 return FilterTagsMode (sourceRow, index);
70 throw std::runtime_error {
"no tags role for the default TagsFilterModel::GetTagsForIndex() implementation" };
72 const auto model = sourceModel ();
76 return TagsManager_->GetTags (model->index (row, 0).data (TagsRole_).value<
QList<TagId>> ());
79 bool TagsFilterModel::FilterTagsMode (
int sourceRow,
const QModelIndex&)
const
81 if (FilterTags_.isEmpty ())
85 const auto hasTag = [&] (
const QString& tag) {
return itemTags.contains (tag); };
89 return std::ranges::any_of (FilterTags_, hasTag);
91 return std::ranges::all_of (FilterTags_, hasTag);
FixedStringFilterProxyModel(QObject *=nullptr)
bool filterAcceptsRow(int row, const QModelIndex &parent) const override
QString GetDefaultTagsSeparator()