![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
Public Types | |
enum | FilterBehavior { SimpleFiltering , FullFiltering , StrictFiltering } |
enum | MatchResult { NoMatch = 0 , DirectMatch , ParentMatch , ChildMatch , SpecialMatch } |
Public Slots | |
void | setSearchTextSettings (const SearchTextSettings &settings) |
Accepts new settings used for filtering and applies them to the model. | |
Signals | |
void | hasSearchResult (bool hasResult) |
Indicates whether the newly applied filter results in a search result or not. | |
void | searchTextSettingsAboutToChange (bool searched, bool willSearch) |
This signal indicates that a new SearchTextSettings arrived and is about to be applied to the model. | |
void | searchTextSettingsChanged (bool wasSearching, bool searched) |
Indicates that new search text settings were applied. | |
void | signalFilterChanged () |
Indicates that a new filter was applied to the model. | |
Public Member Functions | |
AlbumFilterModel (QObject *const parent=nullptr) | |
Album * | albumForIndex (const QModelIndex &index) const |
Convenience methods. | |
QVariant | dataForCurrentSortRole (Album *album) const |
QModelIndex | indexForAlbum (Album *album) const |
virtual bool | isFiltering () const |
Returns if the currently applied filters will result in any filtering. | |
QModelIndex | mapFromSourceAlbumModel (const QModelIndex &index) const |
QModelIndex | mapToSourceAlbumModel (const QModelIndex &index) const |
MatchResult | matchResult (const QModelIndex &index) const |
Returns the MatchResult of an index of this model. | |
QModelIndex | rootAlbumIndex () const |
SearchTextSettings | searchTextSettings () const |
Returns the settings currently used for filtering. | |
void | setFilterBehavior (FilterBehavior behavior) |
Sets the filter behavior. | |
void | setSourceAlbumModel (AbstractAlbumModel *const source) |
Sets the source model. | |
void | setSourceFilterModel (AlbumFilterModel *const source) |
Sets a chained filter model. | |
AbstractAlbumModel * | sourceAlbumModel () const |
AlbumFilterModel * | sourceFilterModel () const |
void | updateFilter () |
Force invalidateFilter() externally. | |
Protected Slots | |
void | slotAlbumRenamed (Album *album) |
void | slotAlbumsHaveBeenUpdated (int type) |
Protected Member Functions | |
bool | filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override |
bool | lessThan (const QModelIndex &left, const QModelIndex &right) const override |
virtual bool | matches (Album *album) const |
This method provides the basic match checking algorithm. | |
MatchResult | matchResult (Album *album) const |
Returns if the filter matches this album (same logic as filterAcceptsRow). | |
void | setSourceModel (QAbstractItemModel *const model) override |
Use setSourceAlbumModel. | |
Protected Attributes | |
QPointer< AlbumFilterModel > | m_chainedModel = nullptr |
FilterBehavior | m_filterBehavior = FullFiltering |
QObject * | m_parent = nullptr |
SearchTextSettings | m_settings |
|
signal |
hasResult | true if the new filter matches any album, else false |
|
virtual |
true
if the current selected filter could result in any filtering without checking if this really happens. Reimplemented in Digikam::CheckableAlbumFilterModel, Digikam::SearchFilterModel, and Digikam::TagPropertiesFilterModel.
|
overrideprotected |
Implementation to sort Tags that contain Unconfirmed Faces, according to the Unconfirmed Face Count.
|
protectedvirtual |
Return true if this single album matches the current criteria. This method can be overridden to provide custom filtering.
album | the album to tell if it matches the filter criteria or not. |
Reimplemented in Digikam::CheckableAlbumFilterModel, Digikam::SearchFilterModel, Digikam::TagPropertiesFilterModel, and Digikam::TagsManagerFilterModel.
|
protected |
An album matches if the search text settings are found in a parent album's title, in the album's title or in a child album's title, or if it is a special album (root) that is never filtered out.
AlbumFilterModel::MatchResult Digikam::AlbumFilterModel::matchResult | ( | const QModelIndex & | index | ) | const |
Never returns NoMatch for a valid index, because in this case, the index would rather be filtered out.
SearchTextSettings Digikam::AlbumFilterModel::searchTextSettings | ( | ) | const |
|
signal |
searched | true if filtering by text was enabled before applying the new settings |
willSearch | true if the new settings can result in any filtering by text, else false . |
|
signal |
wasSearching | true if this is not a new search that |
searched | true if the new settings result in any filtering |
void Digikam::AlbumFilterModel::setFilterBehavior | ( | FilterBehavior | behavior | ) |
Default is FullFiltering.
|
slot |
settings | new settings to apply. An empty text will be interpreted as no filtering |
void Digikam::AlbumFilterModel::setSourceAlbumModel | ( | AbstractAlbumModel *const | source | ) |
Note: If a chained filter model is set, it will not be reset, but the source album model will be made source of the chained filter model.
void Digikam::AlbumFilterModel::setSourceFilterModel | ( | AlbumFilterModel *const | source | ) |
Note: If a direct source album model is set as current source, it will be set as sourceAlbumModel of the new source filter model.
|
overrideprotected |
model | source model |