digiKam
|
Public Types | |
enum | AdditionalRoles { CategoryDisplayRole = 0x17CE990A , CategorySortRole = 0x27857E60 } |
enum | ShowfotoFilterModelRoles { CategorizationModeRole = ShowfotoItemModel::FilterModelRoles + 1 , SortOrderRole = ShowfotoItemModel::FilterModelRoles + 2 , CategoryFormatRole = ShowfotoItemModel::FilterModelRoles + 3 , ShowfotoFilterModelPointerRole = ShowfotoItemModel::FilterModelRoles + 50 } |
Public Slots | |
void | setCategorizationMode (ShowfotoItemSortSettings::CategorizationMode mode) |
void | setSortOrder (ShowfotoItemSortSettings::SortOrder order) |
void | setSortRole (ShowfotoItemSortSettings::SortRole role) |
Signals | |
void | showfotoItemInfosAboutToBeRemoved (const QList< ShowfotoItemInfo > &infos) |
void | showfotoItemInfosAdded (const QList< ShowfotoItemInfo > &infos) |
Public Member Functions | |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
QModelIndex | indexForShowfotoItemId (qlonglong id) const |
QModelIndex | indexForShowfotoItemInfo (const ShowfotoItemInfo &info) const |
QModelIndex | indexForUrl (const QUrl &fileUrl) const |
bool | isCategorizedModel () const |
QModelIndex | mapFromDirectSourceToSourceShowfotoModel (const QModelIndex &sourceModelIndex) const |
QModelIndex | mapFromSourceShowfotoModel (const QModelIndex &showfotoModelIndex) const |
QList< QModelIndex > | mapListFromSource (const QList< QModelIndex > &sourceIndexes) const |
QList< QModelIndex > | mapListToSource (const QList< QModelIndex > &indexes) const |
QModelIndex | mapToSourceShowfotoModel (const QModelIndex &proxyIndex) const |
void | setCategorizedModel (bool categorizedModel) |
void | setSendShowfotoItemInfoSignals (bool sendSignals) |
Enables sending ShowfotoItemInfosAdded and ShowfotoItemInfosAboutToBeRemoved. More... | |
void | setShowfotoItemSortSettings (const ShowfotoItemSortSettings &sorter) |
void | setSortCategoriesByNaturalComparison (bool sortCategoriesByNaturalComparison) |
void | setSourceFilterModel (ShowfotoSortFilterModel *const sourceModel) |
void | setSourceShowfotoModel (ShowfotoItemModel *const sourceModel) |
ShowfotoFilterModel * | showfotoFilterModel () const override |
Returns this, any chained ShowfotoFilterModel, or 0. More... | |
ShowfotoFilterModel (QObject *const parent=nullptr) | |
qlonglong | showfotoItemId (const QModelIndex &index) const |
QList< qlonglong > | showfotoItemIds (const QList< QModelIndex > &indexes) const |
ShowfotoItemInfo | showfotoItemInfo (const QModelIndex &index) const |
QList< ShowfotoItemInfo > | showfotoItemInfos (const QList< QModelIndex > &indexes) const |
QList< ShowfotoItemInfo > | showfotoItemInfosSorted () const |
ShowfotoItemSortSettings | showfotoItemSortSettings () const |
void | sort (int column, Qt::SortOrder order=Qt::AscendingOrder) override |
bool | sortCategoriesByNaturalComparison () const |
int | sortColumn () const |
Qt::SortOrder | sortOrder () const |
ShowfotoSortFilterModel * | sourceFilterModel () const |
ShowfotoItemModel * | sourceShowfotoModel () const |
~ShowfotoFilterModel () override | |
Protected Slots | |
void | slotRowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) |
void | slotRowsInserted (const QModelIndex &parent, int start, int end) |
Protected Member Functions | |
virtual QString | categoryIdentifier (const ShowfotoItemInfo &info) const |
int | compareCategories (const QModelIndex &left, const QModelIndex &right) const override |
virtual int | compareInfosCategories (const ShowfotoItemInfo &left, const ShowfotoItemInfo &right) const |
virtual bool | infosLessThan (const ShowfotoItemInfo &left, const ShowfotoItemInfo &right) const |
bool | lessThan (const QModelIndex &left, const QModelIndex &right) const override |
void | setDirectSourceShowfotoModel (ShowfotoItemModel *const sourceModel) override |
Reimplement if needed. Called only when model shall be set as (direct) sourceModel. More... | |
void | setSourceModel (QAbstractItemModel *sourceModel) override |
bool | subSortLessThan (const QModelIndex &left, const QModelIndex &right) const override |
Protected Attributes | |
ShowfotoFilterModelPrivate *const | d_ptr |
ShowfotoSortFilterModel * | m_chainedModel |
|
inherited |
Enumerator | |
---|---|
CategorizationModeRole | Returns the current categorization mode. |
SortOrderRole | Returns the current sort order. |
CategoryFormatRole | Returns the format of the index which is used for category. |
ShowfotoFilterModelPointerRole | Returns true if the given showfoto item is a group leader, and the group is opened. TODO: GroupIsOpenRole = ShowfotoItemModel::FilterModelRoles + 4 |
|
explicit |
References d_ptr.
|
override |
|
protectedvirtual |
Returns a unique identifier for the category if info. The string need not be for user display.
References ShowFoto::ShowfotoItemSortSettings::CategoryByFolder, ShowFoto::ShowfotoItemSortSettings::CategoryByFormat, ShowFoto::ShowfotoItemInfo::folder, ShowFoto::ShowfotoItemInfo::mime, and ShowFoto::ShowfotoItemSortSettings::NoCategories.
Referenced by data().
|
overrideprotectedvirtual |
This method compares the category of the left
index with the category of the right
index.
Internally and if not reimplemented, this method will ask for left
and right
models for role CategorySortRole. In order to correctly sort categories, the data() method of the model should return a qlonglong (or numeric) value, or a QString object. QString objects will be sorted with QString::localeAwareCompare if sortCategoriesByNaturalComparison() is true.
This means that QString() will be sorted the first one, while QString(QChar(QChar::ObjectReplacementCharacter)) and QString(QChar(QChar::ReplacementCharacter)) will be sorted in last position.
left
should be placed before the category of right
. 0 if left
and right
are on the same category, and a positive value if the category of left
should be placed after the category of right
. Reimplemented from Digikam::DCategorizedSortFilterProxyModel.
References compareInfosCategories().
|
protectedvirtual |
Reimplement to customize category sorting, Return negative if category of left < category right, Return 0 if left and right are in the same category, else return positive.
Referenced by compareCategories().
|
override |
|
inherited |
|
inherited |
|
inherited |
|
protectedvirtual |
Reimplement to customize sorting. Do not take categories into account here.
Referenced by subSortLessThan().
|
inherited |
References Digikam::DCategorizedSortFilterProxyModel::Private::categorizedModel.
Referenced by Digikam::DCategorizedView::categorizedIndexesIn(), Digikam::DCategorizedView::categoryAt(), Digikam::DCategorizedView::categoryRange(), Digikam::DCategorizedView::categoryVisualRect(), Digikam::DCategorizedView::currentChanged(), Digikam::DCategorizedView::dragMoveEvent(), Digikam::DCategorizedView::indexAt(), Digikam::DCategorizedView::mouseMoveEvent(), Digikam::DCategorizedView::mouseReleaseEvent(), Digikam::DCategorizedView::moveCursor(), Digikam::DCategorizedView::paintEvent(), Digikam::DCategorizedView::resizeEvent(), Digikam::DCategorizedView::rowsInserted(), Digikam::DCategorizedView::rowsRemoved(), Digikam::DCategorizedView::setSelection(), Digikam::DCategorizedView::slotLayoutChanged(), Digikam::DCategorizedView::updateGeometries(), and Digikam::DCategorizedView::visualRect().
|
overrideprotectedinherited |
Overridden from QSortFilterProxyModel. If you are subclassing DCategorizedSortFilterProxyModel, you will probably not need to reimplement this method.
It calls compareCategories() to sort by category. If the both items are in the same category (i.e. compareCategories returns 0), then subSortLessThan is called.
left
is less than the item right
when sorting.References Digikam::DCategorizedSortFilterProxyModel::Private::categorizedModel, Digikam::DCategorizedSortFilterProxyModel::compareCategories(), and Digikam::DCategorizedSortFilterProxyModel::subSortLessThan().
|
inherited |
|
inherited |
References ShowFoto::ShowfotoSortFilterModel::m_chainedModel, and ShowFoto::ShowfotoSortFilterModel::mapFromSourceShowfotoModel().
Referenced by ShowFoto::ShowfotoSortFilterModel::indexForShowfotoItemId(), ShowFoto::ShowfotoSortFilterModel::indexForShowfotoItemInfo(), ShowFoto::ShowfotoSortFilterModel::indexForUrl(), ShowFoto::ShowfotoSortFilterModel::mapFromSourceShowfotoModel(), and ShowFoto::ShowfotoSortFilterModel::mapListFromSource().
|
inherited |
Convenience methods mapped to ShowfotoItemModel. Mentioned indexes returned come from the source Showfoto image model.
References ShowFoto::ShowfotoSortFilterModel::m_chainedModel, and ShowFoto::ShowfotoSortFilterModel::mapToSourceShowfotoModel().
Referenced by ShowFoto::ShowfotoSortFilterModel::mapFromDirectSourceToSourceShowfotoModel(), ShowFoto::ShowfotoSortFilterModel::mapListToSource(), ShowFoto::ShowfotoSortFilterModel::mapToSourceShowfotoModel(), and ShowFoto::ShowfotoSortFilterModel::showfotoItemInfo().
|
slot |
References setShowfotoItemSortSettings().
|
inherited |
Enables or disables the categorization feature.
categorizedModel | whether to enable or disable the categorization feature. |
References Digikam::DCategorizedSortFilterProxyModel::Private::categorizedModel.
Referenced by Digikam::CategorizedItemModel::createFilterModel(), Digikam::ActionItemModel::createFilterModel(), Digikam::ImportFilterModel::setCamItemSortSettings(), Digikam::ItemFilterModel::setItemSortSettings(), and setShowfotoItemSortSettings().
|
overrideprotectedvirtual |
Reimplement if needed. Called only when model shall be set as (direct) sourceModel.
Reimplemented from ShowFoto::ShowfotoSortFilterModel.
References ShowFoto::ShowfotoSortFilterModel::setSourceModel().
void ShowFoto::ShowfotoFilterModel::setSendShowfotoItemInfoSignals | ( | bool | sendSignals | ) |
Enables sending ShowfotoItemInfosAdded and ShowfotoItemInfosAboutToBeRemoved.
References slotRowsAboutToBeRemoved(), and slotRowsInserted().
void ShowFoto::ShowfotoFilterModel::setShowfotoItemSortSettings | ( | const ShowfotoItemSortSettings & | sorter | ) |
References ShowFoto::ShowfotoItemSortSettings::NoCategories, and Digikam::DCategorizedSortFilterProxyModel::setCategorizedModel().
Referenced by setCategorizationMode(), setSortOrder(), and setSortRole().
|
inherited |
Set if the sorting using CategorySortRole will use a natural comparison in the case that strings were returned. If enabled, QCollator will be used for sorting.
sortCategoriesByNaturalComparison | whether to sort using a natural comparison or not. |
References Digikam::DCategorizedSortFilterProxyModel::sortCategoriesByNaturalComparison(), and Digikam::DCategorizedSortFilterProxyModel::Private::sortCategoriesByNaturalComparison.
|
slot |
References setShowfotoItemSortSettings().
|
slot |
References setShowfotoItemSortSettings().
|
inherited |
|
overrideprotectedinherited |
|
inherited |
References ShowFoto::ShowfotoSortFilterModel::m_chainedModel, ShowFoto::ShowfotoSortFilterModel::setDirectSourceShowfotoModel(), and ShowFoto::ShowfotoSortFilterModel::setSourceShowfotoModel().
Referenced by ShowFoto::ShowfotoSortFilterModel::setSourceFilterModel(), and ShowFoto::ShowfotoSortFilterModel::setSourceShowfotoModel().
|
overridevirtual |
Returns this, any chained ShowfotoFilterModel, or 0.
Reimplemented from ShowFoto::ShowfotoSortFilterModel.
|
inherited |
|
inherited |
|
inherited |
References ShowFoto::ShowfotoSortFilterModel::mapToSourceShowfotoModel(), ShowFoto::ShowfotoItemModel::showfotoItemInfo(), and ShowFoto::ShowfotoSortFilterModel::sourceShowfotoModel().
Referenced by ShowFoto::ShowfotoSortFilterModel::showfotoItemInfos(), ShowFoto::ShowfotoSortFilterModel::showfotoItemInfosSorted(), slotRowsAboutToBeRemoved(), and slotRowsInserted().
|
inherited |
|
signal |
Referenced by slotRowsAboutToBeRemoved().
|
signal |
These signals need to be explicitly enabled with setSendItemInfoSignals().
Referenced by slotRowsInserted().
|
inherited |
Returns a list of all showfoto infos, sorted according to this model. If you do not need a sorted list, use ShowfotoItemModel's showfotoItemInfo() method.
References ShowFoto::ShowfotoSortFilterModel::showfotoItemInfo().
ShowfotoItemSortSettings ShowFoto::ShowfotoFilterModel::showfotoItemSortSettings | ( | ) | const |
|
protectedslot |
References ShowFoto::ShowfotoSortFilterModel::showfotoItemInfo(), and showfotoItemInfosAboutToBeRemoved().
Referenced by setSendShowfotoItemInfoSignals().
|
protectedslot |
References ShowFoto::ShowfotoSortFilterModel::showfotoItemInfo(), and showfotoItemInfosAdded().
Referenced by setSendShowfotoItemInfoSignals().
|
overrideinherited |
Overridden from QSortFilterProxyModel. Sorts the source model using column
for the given order
.
References Digikam::DCategorizedSortFilterProxyModel::Private::sortColumn, and Digikam::DCategorizedSortFilterProxyModel::Private::sortOrder.
|
inherited |
References Digikam::DCategorizedSortFilterProxyModel::Private::sortCategoriesByNaturalComparison.
Referenced by Digikam::DCategorizedSortFilterProxyModel::setSortCategoriesByNaturalComparison().
|
inherited |
References Digikam::DCategorizedSortFilterProxyModel::Private::sortColumn.
Referenced by Digikam::DCategorizedView::categoryAt(), Digikam::DCategorizedView::categoryRange(), Digikam::DCategorizedView::paintEvent(), and Digikam::DCategorizedView::rowsInsertedArtifficial().
|
inherited |
References Digikam::DCategorizedSortFilterProxyModel::Private::sortOrder.
|
inherited |
|
inherited |
References ShowFoto::ShowfotoSortFilterModel::m_chainedModel, and ShowFoto::ShowfotoSortFilterModel::sourceShowfotoModel().
Referenced by ShowFoto::ShowfotoSortFilterModel::indexForShowfotoItemId(), ShowFoto::ShowfotoSortFilterModel::indexForShowfotoItemInfo(), ShowFoto::ShowfotoSortFilterModel::indexForUrl(), ShowFoto::ShowfotoSortFilterModel::setSourceFilterModel(), ShowFoto::ShowfotoSortFilterModel::showfotoItemInfo(), and ShowFoto::ShowfotoSortFilterModel::sourceShowfotoModel().
|
overrideprotectedvirtual |
This method has a similar purpose as lessThan() has on QSortFilterProxyModel. It is used for sorting items that are in the same category.
left
is less than the item right
when sorting. Reimplemented from Digikam::DCategorizedSortFilterProxyModel.
References ShowFoto::ShowfotoItemModel::ExtraDataRole, and infosLessThan().
|
protected |
Referenced by ShowfotoFilterModel().
|
protectedinherited |
Referenced by ShowFoto::ShowfotoSortFilterModel::mapFromDirectSourceToSourceShowfotoModel(), ShowFoto::ShowfotoSortFilterModel::mapFromSourceShowfotoModel(), ShowFoto::ShowfotoSortFilterModel::mapToSourceShowfotoModel(), ShowFoto::ShowfotoSortFilterModel::setSourceFilterModel(), ShowFoto::ShowfotoSortFilterModel::setSourceShowfotoModel(), ShowFoto::ShowfotoSortFilterModel::showfotoFilterModel(), ShowFoto::ShowfotoSortFilterModel::sourceFilterModel(), and ShowFoto::ShowfotoSortFilterModel::sourceShowfotoModel().