10#include <QRegularExpression>
27 endFilterChange (Direction::Rows);
33 Separator_ = separator;
34 endFilterChange (Direction::Rows);
41 endFilterChange (Direction::Rows);
48 endFilterChange (Direction::Rows);
54 for (
const auto& s : QStringView {
string }.split (Separator_, Qt::SkipEmptyParts))
55 FilterTags_ << s.trimmed ().toString ();
63 return FilterTagsMode (sourceRow, index);
69 throw std::runtime_error {
"no tags role for the default TagsFilterModel::GetTagsForIndex() implementation" };
71 const auto model = sourceModel ();
75 return model->index (row, 0).data (TagsRole_).toStringList ();
78 bool TagsFilterModel::FilterTagsMode (
int sourceRow,
const QModelIndex&)
const
80 if (FilterTags_.isEmpty ())
84 const auto hasTag = [&] (
const QString& tag) {
return itemTags.contains (tag); };
88 return std::ranges::any_of (FilterTags_, hasTag);
90 return std::ranges::all_of (FilterTags_, hasTag);
FixedStringFilterProxyModel(QObject *=nullptr)
bool filterAcceptsRow(int row, const QModelIndex &parent) const override
QString GetDefaultTagsSeparator()