digiKam
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

QStringList checkedDisplayTexts () const
 
QVariantList checkedKeys () const
 
template<typename T >
QList< TcheckedKeys () const
 
 ChoiceSearchModel (QObject *const parent=nullptr)
 
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 ()
 
int rowCount (const QModelIndex &parent) const override
 
template<typename T >
void setChecked (const QList< T > &keys, bool checked=true)
 
template<typename T >
void setChecked (const T &key, bool checked=true)
 
template<typename T >
void setChecked (const T &value, SearchXml::Relation relation)
 
void setChoice (const QMap< int, QString > &data)
 
void setChoice (const QStringList &data)
 
void setChoice (const QVariantList &data)
 
bool setData (const QModelIndex &index, const QVariant &value, int role) override
 

Protected Member Functions

void setChecked (int index, bool checked)
 

Protected Attributes

QList< Entrym_entries
 

Member Enumeration Documentation

◆ CustomRoles

Enumerator
IdRole 

Constructor & Destructor Documentation

◆ ChoiceSearchModel()

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

Member Function Documentation

◆ checkedDisplayTexts()

QStringList Digikam::ChoiceSearchModel::checkedDisplayTexts ( ) const

Returns the display text of all entries that are selected.

References m_entries.

Referenced by Digikam::SearchFieldChoice::updateComboText().

◆ checkedKeys() [1/2]

QVariantList Digikam::ChoiceSearchModel::checkedKeys ( ) const

Returns the keys of all entries that are selected (checked).

References m_entries.

Referenced by Digikam::SearchFieldChoice::write().

◆ checkedKeys() [2/2]

template<typename T >
QList< T > Digikam::ChoiceSearchModel::checkedKeys

Returns the keys of all entries that are selected (checked), converted to a list of the template type. Supported for Int and QString types.

References m_entries, and T.

◆ checkStateChanged

void Digikam::ChoiceSearchModel::checkStateChanged ( const QVariant &  key,
bool  isChecked 
)
signal

Referenced by setChecked().

◆ data()

QVariant Digikam::ChoiceSearchModel::data ( const QModelIndex &  index,
int  role 
) const
override

References IdRole, index(), and m_entries.

Referenced by setChoice().

◆ flags()

Qt::ItemFlags Digikam::ChoiceSearchModel::flags ( const QModelIndex &  index) const
override

References index().

◆ index()

QModelIndex Digikam::ChoiceSearchModel::index ( int  row,
int  column = 0,
const QModelIndex &  parent = QModelIndex() 
) const
override

References m_entries.

Referenced by data(), flags(), setChecked(), and setData().

◆ resetChecked()

void Digikam::ChoiceSearchModel::resetChecked ( )

Sets all entries to unchecked.

References m_entries, and setChecked().

Referenced by Digikam::SearchFieldChoice::reset().

◆ rowCount()

int Digikam::ChoiceSearchModel::rowCount ( const QModelIndex &  parent) const
override

References m_entries.

◆ setChecked() [1/4]

template<typename T >
void Digikam::ChoiceSearchModel::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.

References setChecked(), and T.

◆ setChecked() [2/4]

template<typename T >
void Digikam::ChoiceSearchModel::setChecked ( const T key,
bool  checked = true 
)

Sets the check state of the entry with given key.

References m_entries.

Referenced by Digikam::SearchFieldChoice::read(), resetChecked(), setChecked(), and setData().

◆ setChecked() [3/4]

template<typename T >
void Digikam::ChoiceSearchModel::setChecked ( const T value,
SearchXml::Relation  relation 
)

Sets the check state of all entries. 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.

References m_entries, setChecked(), T, Digikam::SearchXml::testRelation(), and value.

◆ setChecked() [4/4]

void Digikam::ChoiceSearchModel::setChecked ( int  index,
bool  checked 
)
protected

◆ setChoice() [1/3]

void Digikam::ChoiceSearchModel::setChoice ( const QMap< int, QString > &  data)

Sets the data from the given map, with integer keys and QString user displayable value.

References data(), and m_entries.

Referenced by Digikam::SearchFieldChoice::setChoice().

◆ setChoice() [2/3]

void Digikam::ChoiceSearchModel::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.

References data(), m_entries, and value.

◆ setChoice() [3/3]

void Digikam::ChoiceSearchModel::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. Ensure that the QVariants' type is correct (identical for all even entries, QString for all odd entries).

References data(), m_entries, and value.

◆ setData()

bool Digikam::ChoiceSearchModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)
override

References index(), setChecked(), and value.

Member Data Documentation

◆ m_entries

QList<Entry> Digikam::ChoiceSearchModel::m_entries
protected

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