digiKam
Digikam::TagPropertiesFilterModel Class Reference
+ Inheritance diagram for Digikam::TagPropertiesFilterModel:

Public Types

enum  FilterBehavior { SimpleFiltering , FullFiltering , StrictFiltering }
 
enum  MatchResult {
  NoMatch = 0 , DirectMatch , ParentMatch , ChildMatch ,
  SpecialMatch
}
 

Public Slots

void setSearchTextSettings (const SearchTextSettings &settings)
 

Signals

void hasSearchResult (bool hasResult)
 
void searchTextSettingsAboutToChange (bool searched, bool willSearch)
 
void searchTextSettingsChanged (bool wasSearching, bool searched)
 
void signalFilterChanged ()
 

Public Member Functions

AlbumalbumForIndex (const QModelIndex &index) const
 Convenience methods. More...
 
QVariant dataForCurrentSortRole (Album *album) const
 
void doNotListTagsWithProperty (const QString &property)
 
QModelIndex indexForAlbum (Album *album) const
 
bool isFiltering () const override
 
void listOnlyTagsWithProperty (const QString &property)
 
QModelIndex mapFromSourceAlbumModel (const QModelIndex &index) const
 
QModelIndex mapToSourceAlbumModel (const QModelIndex &index) const
 
MatchResult matchResult (const QModelIndex &index) const
 
void removeDoNotListProperty (const QString &property)
 
void removeListOnlyProperty (const QString &property)
 
QModelIndex rootAlbumIndex () const
 
SearchTextSettings searchTextSettings () const
 
void setFilterBehavior (FilterBehavior behavior)
 
void setFilterChecked (bool filter)
 
void setFilterPartiallyChecked (bool filter)
 
void setSourceAlbumModel (AbstractAlbumModel *const source)
 
void setSourceAlbumModel (AbstractCheckableAlbumModel *const source)
 
void setSourceAlbumModel (TagModel *const source)
 
void setSourceFilterModel (AlbumFilterModel *const source)
 
void setSourceFilterModel (CheckableAlbumFilterModel *const source)
 
AbstractCheckableAlbumModelsourceAlbumModel () const
 
AlbumFilterModelsourceFilterModel () const
 
TagModelsourceTagModel () const
 
 TagPropertiesFilterModel (QObject *const parent=nullptr)
 
void updateFilter ()
 

Static Public Member Functions

template<typename T >
static int compareByOrder (const T &a, const T &b, Qt::SortOrder sortOrder)
 
static int compareByOrder (int compareResult, Qt::SortOrder sortOrder)
 
template<typename T >
static int compareValue (const T &a, const T &b)
 

Protected Slots

void slotAlbumRenamed (Album *album)
 
void slotAlbumsHaveBeenUpdated (int type)
 
void tagPropertiesChanged (TAlbum *)
 

Protected Member Functions

bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override
 
bool lessThan (const QModelIndex &left, const QModelIndex &right) const override
 
bool matches (Album *album) const override
 
MatchResult matchResult (Album *album) const
 
void setSourceModel (QAbstractItemModel *const model) override
 

Protected Attributes

QPointer< AlbumFilterModelm_chainedModel
 
FilterBehavior m_filterBehavior
 
bool m_filterChecked
 
bool m_filterPartiallyChecked
 
QObject * m_parent
 
QSet< QString > m_propertiesBlackList
 
QSet< QString > m_propertiesWhiteList
 
SearchTextSettings m_settings
 

Detailed Description

Filter model for tags that can filter by tag property

Member Enumeration Documentation

◆ FilterBehavior

Enumerator
SimpleFiltering 

If an index does not matched, the index and all its children are filtered out. This is the Qt default behavior, but undesirable for album trees.

FullFiltering 

Default behavior. If an index matches, it is shown, which directly means all its parents are shown as well. In addition, all its children are shown as well.

StrictFiltering 

If an index matches, it is shown, which directly means all its parents are shown as well. Its children are not shown unless they also match.

◆ MatchResult

Enumerator
NoMatch 

This enum can be used as a boolean value if match/no match only is needed.

DirectMatch 

The index itself is matched.

ParentMatch 

A parent if the index is matched.

ChildMatch 

A child of the index is matched.

SpecialMatch 

The index is matched not because of search settings, but because it has a special type.

Constructor & Destructor Documentation

◆ TagPropertiesFilterModel()

Digikam::TagPropertiesFilterModel::TagPropertiesFilterModel ( QObject *const  parent = nullptr)
explicit

Member Function Documentation

◆ albumForIndex()

◆ compareByOrder() [1/2]

template<typename T >
static int Digikam::AlbumFilterModel::compareByOrder ( const T a,
const T b,
Qt::SortOrder  sortOrder 
)
inlinestaticinherited

◆ compareByOrder() [2/2]

static int Digikam::AlbumFilterModel::compareByOrder ( int  compareResult,
Qt::SortOrder  sortOrder 
)
inlinestaticinherited

Takes a typical result from a compare method (0 is equal, -1 is less than, 1 is greater than) and applies the given sort order to it.

Referenced by Digikam::AlbumFilterModel::lessThan().

◆ compareValue()

template<typename T >
static int Digikam::AlbumFilterModel::compareValue ( const T a,
const T b 
)
inlinestaticinherited

Returns the usual compare result of -1, 0, or 1 for lessThan, equals and greaterThan.

◆ dataForCurrentSortRole()

◆ doNotListTagsWithProperty()

void Digikam::TagPropertiesFilterModel::doNotListTagsWithProperty ( const QString &  property)

◆ filterAcceptsRow()

bool Digikam::AlbumFilterModel::filterAcceptsRow ( int  source_row,
const QModelIndex &  source_parent 
) const
overrideprotectedinherited

◆ hasSearchResult

void Digikam::AlbumFilterModel::hasSearchResult ( bool  hasResult)
signalinherited

Indicates whether the newly applied filter results in a search result or not.

Parameters
hasResulttrue if the new filter matches any album, else false

Referenced by Digikam::AlbumFilterModel::setSearchTextSettings().

◆ indexForAlbum()

◆ isFiltering()

bool Digikam::TagPropertiesFilterModel::isFiltering ( ) const
overridevirtual

Returns if the currently applied filters will result in any filtering.

Returns
true if the current selected filter could result in any filtering without checking if this really happens.

Reimplemented from Digikam::CheckableAlbumFilterModel.

References m_propertiesBlackList, and m_propertiesWhiteList.

Referenced by tagPropertiesChanged().

◆ lessThan()

◆ listOnlyTagsWithProperty()

void Digikam::TagPropertiesFilterModel::listOnlyTagsWithProperty ( const QString &  property)

◆ mapFromSourceAlbumModel()

QModelIndex Digikam::AlbumFilterModel::mapFromSourceAlbumModel ( const QModelIndex &  index) const
inherited

◆ mapToSourceAlbumModel()

QModelIndex Digikam::AlbumFilterModel::mapToSourceAlbumModel ( const QModelIndex &  index) const
inherited

◆ matches()

bool Digikam::TagPropertiesFilterModel::matches ( Album album) const
overrideprotectedvirtual

This method provides the basic match checking algorithm. Return true if this single album matches the current criteria. This method can be overridden to provide custom filtering.

Parameters
albumthe album to tell if it matches the filter criteria or not.

Reimplemented from Digikam::CheckableAlbumFilterModel.

Reimplemented in Digikam::TagsManagerFilterModel.

References Digikam::TAlbum::hasProperty(), m_propertiesBlackList, m_propertiesWhiteList, and Digikam::CheckableAlbumFilterModel::matches().

Referenced by Digikam::TagsManagerFilterModel::matches().

◆ matchResult() [1/2]

AlbumFilterModel::MatchResult Digikam::AlbumFilterModel::matchResult ( Album album) const
protectedinherited

◆ matchResult() [2/2]

AlbumFilterModel::MatchResult Digikam::AlbumFilterModel::matchResult ( const QModelIndex &  index) const
inherited

Returns the MatchResult of an index of this model. Never returns NoMatch for a valid index, because in this case, the index would rather be filtered out.

References Digikam::AlbumFilterModel::albumForIndex().

Referenced by Digikam::AbstractAlbumTreeView::expandMatches(), and Digikam::AlbumFilterModel::filterAcceptsRow().

◆ removeDoNotListProperty()

void Digikam::TagPropertiesFilterModel::removeDoNotListProperty ( const QString &  property)

◆ removeListOnlyProperty()

void Digikam::TagPropertiesFilterModel::removeListOnlyProperty ( const QString &  property)

◆ rootAlbumIndex()

◆ searchTextSettings()

SearchTextSettings Digikam::AlbumFilterModel::searchTextSettings ( ) const
inherited

Returns the settings currently used for filtering.

Returns
current settings for filtering.

References Digikam::AlbumFilterModel::m_settings.

◆ searchTextSettingsAboutToChange

void Digikam::AlbumFilterModel::searchTextSettingsAboutToChange ( bool  searched,
bool  willSearch 
)
signalinherited

This signal indicates that a new SearchTextSettings arrived and is about to be applied to the model.

Parameters
searchedtrue if filtering by text was enabled before applying the new settings
willSearchtrue if the new settings can result in any filtering by text, else false.

Referenced by Digikam::AlbumFilterModel::setSearchTextSettings().

◆ searchTextSettingsChanged

void Digikam::AlbumFilterModel::searchTextSettingsChanged ( bool  wasSearching,
bool  searched 
)
signalinherited

Indicates that new search text settings were applied.

Parameters
wasSearchingtrue if this is not a new search that
searchedtrue if the new settings result in any filtering

Referenced by Digikam::AlbumFilterModel::setSearchTextSettings().

◆ setFilterBehavior()

void Digikam::AlbumFilterModel::setFilterBehavior ( FilterBehavior  behavior)
inherited

Sets the filter behavior. Default is FullFiltering.

References Digikam::AlbumFilterModel::m_filterBehavior.

◆ setFilterChecked()

void Digikam::CheckableAlbumFilterModel::setFilterChecked ( bool  filter)
inherited

◆ setFilterPartiallyChecked()

void Digikam::CheckableAlbumFilterModel::setFilterPartiallyChecked ( bool  filter)
inherited

◆ setSearchTextSettings

◆ setSourceAlbumModel() [1/3]

void Digikam::AlbumFilterModel::setSourceAlbumModel ( AbstractAlbumModel *const  source)
inherited

◆ setSourceAlbumModel() [2/3]

void Digikam::CheckableAlbumFilterModel::setSourceAlbumModel ( AbstractCheckableAlbumModel *const  source)
inherited

◆ setSourceAlbumModel() [3/3]

void Digikam::TagPropertiesFilterModel::setSourceAlbumModel ( TagModel *const  source)

◆ setSourceFilterModel() [1/2]

void Digikam::AlbumFilterModel::setSourceFilterModel ( AlbumFilterModel *const  source)
inherited

Sets a chained filter model. Note: If a direct source album model is set as current source, it will be set as sourceAlbumModel of the new source filter model.

References Digikam::AlbumFilterModel::m_chainedModel, Digikam::AlbumFilterModel::setSourceAlbumModel(), Digikam::AlbumFilterModel::setSourceModel(), and Digikam::AlbumFilterModel::sourceAlbumModel().

Referenced by Digikam::CheckableAlbumFilterModel::setSourceFilterModel().

◆ setSourceFilterModel() [2/2]

◆ setSourceModel()

void Digikam::AlbumFilterModel::setSourceModel ( QAbstractItemModel *const  model)
overrideprotectedinherited

Use setSourceAlbumModel.

See also
setSourceAlbumModel
Parameters
modelsource model

Referenced by Digikam::AlbumFilterModel::setSourceAlbumModel(), and Digikam::AlbumFilterModel::setSourceFilterModel().

◆ signalFilterChanged

◆ slotAlbumRenamed

void Digikam::AlbumFilterModel::slotAlbumRenamed ( Album album)
protectedslotinherited

◆ slotAlbumsHaveBeenUpdated

void Digikam::AlbumFilterModel::slotAlbumsHaveBeenUpdated ( int  type)
protectedslotinherited

◆ sourceAlbumModel()

AbstractCheckableAlbumModel * Digikam::CheckableAlbumFilterModel::sourceAlbumModel ( ) const
inherited

◆ sourceFilterModel()

AlbumFilterModel * Digikam::AlbumFilterModel::sourceFilterModel ( ) const
inherited

◆ sourceTagModel()

TagModel * Digikam::TagPropertiesFilterModel::sourceTagModel ( ) const

◆ tagPropertiesChanged

void Digikam::TagPropertiesFilterModel::tagPropertiesChanged ( TAlbum )
protectedslot

References isFiltering().

Referenced by TagPropertiesFilterModel().

◆ updateFilter()

void Digikam::AlbumFilterModel::updateFilter ( )
inherited

Force invalidateFilter() externally.

References Digikam::AlbumFilterModel::isFiltering().

Member Data Documentation

◆ m_chainedModel

◆ m_filterBehavior

FilterBehavior Digikam::AlbumFilterModel::m_filterBehavior
protectedinherited

◆ m_filterChecked

bool Digikam::CheckableAlbumFilterModel::m_filterChecked
protectedinherited

◆ m_filterPartiallyChecked

bool Digikam::CheckableAlbumFilterModel::m_filterPartiallyChecked
protectedinherited

◆ m_parent

QObject* Digikam::AlbumFilterModel::m_parent
protectedinherited

◆ m_propertiesBlackList

QSet<QString> Digikam::TagPropertiesFilterModel::m_propertiesBlackList
protected

◆ m_propertiesWhiteList

QSet<QString> Digikam::TagPropertiesFilterModel::m_propertiesWhiteList
protected

◆ m_settings


The documentation for this class was generated from the following files: