digiKam Developer Documentation: Digikam::ChoiceSearchModel Class Reference

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

Loading...
Searching...
No Matches
Classes | Public Types | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Digikam::ChoiceSearchModel Class Reference
Inheritance diagram for Digikam::ChoiceSearchModel:

## Classes
class | Entry

## Public Types
enum | CustomRoles { IdRole = Qt::UserRole }

## Signals
void | checkStateChanged (const QVariant &key, bool isChecked)

## Public Member Functions
| ChoiceSearchModel (QObject *const parent=nullptr)
QStringList | checkedDisplayTexts () const
| Returns the display text of all entries that are selected.
QVariantList | checkedKeys () const
| Returns the keys of all entries that are selected (checked).
template<typename T >
QList< T > | checkedKeys () const
| Returns the keys of all entries that are selected (checked), converted to a list of the template type.
QVariant | data (const QModelIndex &index, int role) const override
Qt::ItemFlags | flags (const QModelIndex &index) const override
QModelIndex | index (int row, int column=0, const QModelIndex &parent=QModelIndex()) const override
void | resetChecked ()
| Sets all entries to unchecked.
int | rowCount (const QModelIndex &parent) const override
template<typename T >
void | setChecked (const QList< T > &keys, bool checked=true)
| Sets the check state of all the entries whose key is found in the list to checked.
template<typename T >
void | setChecked (const T &key, bool checked=true)
| Sets the check state of the entry with given key.
template<typename T >
void | setChecked (const T &value, SearchXml::Relation relation)
| Sets the check state of all entries.
void | setChoice (const QMap< int, QString > &data)
| Sets the data from the given map, with integer keys and QString user displayable value.
void | setChoice (const QStringList &data)
| Sets the data from the given list, taking every first entry as the key, every second as the user displayable value.
void | setChoice (const QVariantList &data)
| Sets the data from the given list, taking every first entry as the key, every second as the user displayable value.
bool | setData (const QModelIndex &index, const QVariant &value, int role) override

## Protected Member Functions
void | setChecked (int index, bool checked)

## Protected Attributes
QList< Entry > | m_entries

## Member Function Documentation

## ◆ checkedKeys()

template<typename T >

QList< T > Digikam::ChoiceSearchModel::checkedKeys | ( |  | ) | const

Supported for Int and QString types.

## ◆ setChecked()

template<typename T >

void Digikam::ChoiceSearchModel::setChecked | ( | const T & | value,
|  | SearchXml::Relation | relation
| ) |  |

The check state is determined by the key of an entry, the relation, and a constant value. Think of "Set to checked if key is less than 5". Supported for Int and QString types.

## ◆ setChoice()

void Digikam::ChoiceSearchModel::setChoice | ( | const QVariantList & | data | ) |

Ensure that the QVariants' type is correct (identical for all even entries, QString for all odd entries).