![]() |
LeechCraft
0.6.70-13729-g7046a9d2a7
Modular cross-platform feature rich live environment.
|
Provides filter model with additional tags filter mode. More...
#include "tagsfiltermodel.h"
Public Types | |
enum | TagsInclusionMode { TagsInclusionMode::Any, TagsInclusionMode::All } |
Describes the modes of matching two sets of tags. More... | |
Public Slots | |
void | setTagsMode (bool enabled) |
Sets whether the tags filtering mode is enabled. More... | |
void | enableTagsMode () |
Convenience slot enabling the tags mode. More... | |
void | disableTagsMode () |
Convenience slot disabling the tags mode. More... | |
Public Member Functions | |
TagsFilterModel (QObject *parent=0) | |
Creates the model with the given parent. More... | |
void | SetSeparator (const QString &separator) |
Sets the separator for the tags. More... | |
void | SetTagsInclusionMode (TagsInclusionMode mode) |
Sets the tags inclusion mode. More... | |
Protected Member Functions | |
virtual bool | filterAcceptsRow (int, const QModelIndex &) const |
Reimplemented from QSortFilterProxyModel::filterAcceptsRow(). More... | |
virtual QStringList | GetTagsForIndex (int row) const =0 |
Returns the list of tags for the given row. More... | |
Provides filter model with additional tags filter mode.
This model behaves just like a normal QSortFilterProxyModel except it supports filtering by tags. In this mode row is accepted either if all tags from the request are found in the row (the default mode) or if the intersection of the two sets is just non-empty. The mode can be set via SetTagsInclusionMode() function. The tags filtering mode itself is enabled via setTagsMode() slot.
The tags are obtained by splitting the filter pattern by the separator, which is ; by default but can be set via the SetSeparator() method.
Definition at line 52 of file tagsfiltermodel.h.
|
strong |
Describes the modes of matching two sets of tags.
Definition at line 63 of file tagsfiltermodel.h.
LC::Util::TagsFilterModel::TagsFilterModel | ( | QObject * | parent = 0 | ) |
Creates the model with the given parent.
[in] | parent | The parent object of this model. |
Definition at line 38 of file tagsfiltermodel.cpp.
|
slot |
Convenience slot disabling the tags mode.
This slot is equivalent to setTagsMode (false)
.
Definition at line 75 of file tagsfiltermodel.cpp.
References setTagsMode().
|
slot |
Convenience slot enabling the tags mode.
This slot is equivalent to setTagsMode (true)
.
Definition at line 70 of file tagsfiltermodel.cpp.
References setTagsMode().
|
protectedvirtual |
Reimplemented from QSortFilterProxyModel::filterAcceptsRow().
Definition at line 80 of file tagsfiltermodel.cpp.
References Any, and GetTagsForIndex().
|
protectedpure virtual |
Returns the list of tags for the given row.
This function should return the list of tags for the given row. Reimplement it in your subclass to provide this filter model with correct tags for rows.
[in] | row | The source row for which tags should be fetched. |
Referenced by filterAcceptsRow().
void LC::Util::TagsFilterModel::SetSeparator | ( | const QString & | separator | ) |
Sets the separator for the tags.
The separator is used to split the regexp filter string (the one set via setFilterFixedString()
method) into the list of tags.
The default separator is ;.
Setting this property will invalidate the model if the dynamicSortFilter()
property is true.
[in] | separator | The separator string. |
Definition at line 46 of file tagsfiltermodel.cpp.
void LC::Util::TagsFilterModel::SetTagsInclusionMode | ( | TagsFilterModel::TagsInclusionMode | mode | ) |
Sets the tags inclusion mode.
Setting this property will invalidate the model if the dynamicSortFilter()
property is true.
[in] | mode | The tags inclusion mode. |
Definition at line 54 of file tagsfiltermodel.cpp.
|
slot |
Sets whether the tags filtering mode is enabled.
By default the tags mode is disabled.
[in] | enabled | Whether the tags mode should be enabled. |
Definition at line 62 of file tagsfiltermodel.cpp.
Referenced by disableTagsMode(), and enableTagsMode().