digiKam Developer Documentation: Digikam::ItemSortSettings Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Digikam::ItemSortSettings Class Reference

## Public Types
enum | CategorizationMode { NoCategories , OneCategory , CategoryByAlbum , CategoryByFormat , CategoryByFaces , CategoryByMonth , CategoryByDay }
enum | SortOrder { AscendingOrder = Qt::AscendingOrder , DescendingOrder = Qt::DescendingOrder , DefaultOrder }
enum | SortRole { SortByFileName , SortByFilePath , SortByCreationDate , SortByModificationDate , SortByFileSize , SortByFormat , SortByRating , SortByPickLabel , SortByColorLabel , SortByImageSize , SortByOrientation , SortByAspectRatio , SortByGpsPosition , SortByFaces , SortBySimilarity , SortByManualOrderAndName , SortByManualOrderAndDate }

## Public Member Functions
int | compare (const ItemInfo &left, const ItemInfo &right) const
| Compares the ItemInfos left and right.
int | compare (const ItemInfo &left, const ItemInfo &right, SortRole sortRole) const
| — Image Sorting —
int | compareCategories (const ItemInfo &left, const ItemInfo &right, const FaceTagsIface &leftFace, const FaceTagsIface &rightFace) const
| Compares the categories of left and right.
bool | isCategorized () const
bool | lessThan (const ItemInfo &left, const ItemInfo &right) const
bool | lessThan (const QVariant &left, const QVariant &right) const
bool | operator== (const ItemSortSettings &other) const
void | setCategorizationMode (CategorizationMode mode)
| — Categories —
void | setCategorizationSortOrder (SortOrder order)
void | setSortOrder (SortOrder order)
void | setSortRole (SortRole role)
void | setStringTypeNatural (bool natural)
DatabaseFields::Set | watchFlags () const
| — Change notification —

## 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)
| 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.
template<typename T >
static int | compareValue (const T &a, const T &b)
static Qt::SortOrder | defaultSortOrderForCategorizationMode (CategorizationMode mode)
static Qt::SortOrder | defaultSortOrderForSortRole (SortRole role)
template<typename T >
static bool | lessThanByOrder (const T &a, const T &b, Qt::SortOrder sortOrder)
| — Utilities —
static int | naturalCompare (const QString &a, const QString &b, Qt::SortOrder sortOrder, Qt::CaseSensitivity caseSensitive=Qt::CaseSensitive, bool natural=true)
| Compares the two string by natural comparison and adheres to given sort order.

## Public Attributes
Qt::CaseSensitivity | categorizationCaseSensitivity = Qt::CaseSensitive
CategorizationMode | categorizationMode = NoCategories
SortOrder | categorizationSortOrder = DefaultOrder
Qt::SortOrder | currentCategorizationSortOrder = Qt::AscendingOrder
| Only Ascending or Descending, never DefaultOrder.
Qt::SortOrder | currentSortOrder = Qt::AscendingOrder
Qt::CaseSensitivity | sortCaseSensitivity = Qt::CaseSensitive
SortOrder | sortOrder = DefaultOrder
SortRole | sortRole = SortByFileName
bool | strTypeNatural = true

## Member Enumeration Documentation

## ◆ CategorizationMode

enum Digikam::ItemSortSettings::CategorizationMode

Enumerator
NoCategories | categorization switched off
OneCategory | all items in one global category

## ◆ SortOrder

enum Digikam::ItemSortSettings::SortOrder

Enumerator
DefaultOrder | sort order depends on the chosen sort role

## ◆ SortRole

enum Digikam::ItemSortSettings::SortRole

Enumerator
SortByFileName | Compare by file name in alphabetical order.
SortByFilePath | Compare by file path in alphabetical order.
SortByCreationDate | Compare by camera creation date.
SortByModificationDate | Compare by date modified by the computer.
SortByFileSize | Compare by file size in bytes.
SortByFormat | Compare by type-mime in alphabetical order.
SortByRating | Compare by Rating order.
SortByPickLabel | Compare by Pick Label order.
SortByColorLabel | Compare by Color Label order.
SortByImageSize | Compare by pixels number.
SortByOrientation | Compare by Exif Rotation flag.
SortByAspectRatio | Compare by aspect ratio computed as ((width / height) * 100000).
SortByGpsPosition | Compare by GPS location properties. If an image lacks GPS coordinates it is placed after images with GPS data. If both images lack GPS data, they are treated as equal. The primary sort is by latitude, followed by longitude if latitudes are equal.
SortByFaces | Compare by counting the number of unconfirmed faces.
SortBySimilarity | Compare by similarity results (only available in the Similarity Search View).
SortByManualOrderAndName | Compare by the manual sorting order and the file name.
SortByManualOrderAndDate | Compare by the manual sorting order and the creation date.

## Member Function Documentation

## ◆ compare()

int Digikam::ItemSortSettings::compare | ( | const ItemInfo & | left,
|  | const ItemInfo & | right
| ) |  | const

Returns
  -1 if left is less than right, 1 if left is greater than right, and 0 if left equals right comparing the current sort role's value. Adheres to set sort role and sort order.

## ◆ compareCategories()

int Digikam::ItemSortSettings::compareCategories | ( | const ItemInfo & | left,
|  | const ItemInfo & | right,
|  | const FaceTagsIface & | leftFace,
|  | const FaceTagsIface & | rightFace
| ) |  | const

Return -1 if left is less than right, 0 if both fall in the same category, and 1 if left is greater than right. Adheres to set categorization mode and current category sort order. Face passed in to allow Categorization by Faces. Pass in an empty Face if not needed.

## ◆ compareValue()

template<typename T >

static int Digikam::ItemSortSettings::compareValue | ( | const T & | a,
|  | const T & | b
| ) |  |
| inlinestatic

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

## ◆ lessThan() [1/2]

bool Digikam::ItemSortSettings::lessThan | ( | const ItemInfo & | left,
|  | const ItemInfo & | right
| ) |  | const

Returns
  True if left is less than right. Adheres to current sort role and sort order.

## ◆ lessThan() [2/2]

bool Digikam::ItemSortSettings::lessThan | ( | const QVariant & | left,
|  | const QVariant & | right
| ) |  | const

Returns
  True if left QVariant is less than right. Adheres to current sort role and sort order. Use for extraValue, if necessary.

## ◆ lessThanByOrder()

template<typename T >

static bool Digikam::ItemSortSettings::lessThanByOrder | ( | const T & | a,
|  | const T & | b,
|  | Qt::SortOrder | sortOrder
| ) |  |
| inlinestatic

Returns
  a < b if sortOrder is Ascending, or b < a if order is descending.

## ◆ watchFlags()

DatabaseFields::Set Digikam::ItemSortSettings::watchFlags | ( |  | ) | const

Returns
  Database fields a change in which would affect the current sorting.