KPeople 5.109.0
Public Types | Properties | Signals | Public Member Functions | List of all members
KPeople::PersonsModel

This class creates a model of all known contacts from all sources Contacts are represented as a tree where the top level represents a "person" which is an amalgamation of all the sub-contacts. More...

#include <personsmodel.h>

Public Types

enum  Role {
  FormattedNameRole = Qt::DisplayRole , PhotoRole = Qt::DecorationRole , PersonUriRole = Qt::UserRole , PersonVCardRole ,
  ContactsVCardRole , GroupsRole , PhoneNumberRole , PhotoImageProviderUri ,
  UserRole = Qt::UserRole + 0x1000
}
 

Properties

bool isInitialized
 specifies whether the model has already been initialized
 

Signals

void modelInitialized (bool success)
 Will emit when the model is finally initialized.
 

Public Member Functions

 PersonsModel (QObject *parent=nullptr)
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant contactCustomProperty (const QModelIndex &index, const QString &key) const
 Makes it possible to access custom properties that are not available to the model.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
QVariant get (int row, int role)
 Helper class to ease model access through QML.
 
QModelIndex index (int row, int column=0, const QModelIndex &parent=QModelIndex()) const override
 
QModelIndex indexForPersonUri (const QString &personUri) const
 
bool isInitialized () const
 Returns if all the backends have been initialized yet.
 
QModelIndex parent (const QModelIndex &index) const override
 
QHash< int, QByteArray > roleNames () const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 

Detailed Description

This class creates a model of all known contacts from all sources Contacts are represented as a tree where the top level represents a "person" which is an amalgamation of all the sub-contacts.

Since
5.8

Member Enumeration Documentation

◆ Role

Enumerator
PhoneNumberRole 

groups QStringList

PhotoImageProviderUri 

Provide a URL to use with QtQuick's Image.source, similar to the Photo Role.

Since
5.93
UserRole 

in case it's needed to extend, use this one to start from

Property Documentation

◆ isInitialized

bool KPeople::PersonsModel::isInitialized
read

specifies whether the model has already been initialized

Member Function Documentation

◆ contactCustomProperty()

QVariant KPeople::PersonsModel::contactCustomProperty ( const QModelIndex &  index,
const QString &  key 
) const

Makes it possible to access custom properties that are not available to the model.

Returns
the property for the contact at index defined by the key

◆ get()

QVariant KPeople::PersonsModel::get ( int  row,
int  role 
)

Helper class to ease model access through QML.

◆ indexForPersonUri()

QModelIndex KPeople::PersonsModel::indexForPersonUri ( const QString &  personUri) const
Returns
the index for a given personUri

◆ isInitialized()

bool KPeople::PersonsModel::isInitialized ( ) const

Returns if all the backends have been initialized yet.

◆ modelInitialized

void KPeople::PersonsModel::modelInitialized ( bool  success)
signal

Will emit when the model is finally initialized.

success will specify if it succeeded