KPeople::PersonsModel Class
class KPeople::PersonsModelThis class creates a model of all known contacts from all sources. More...
Header: | #include <KPeople/PersonsModel> |
CMake: | find_package(KF6 REQUIRED COMPONENTS People) target_link_libraries(mytarget PRIVATE KF6::People) |
Since: | 5.8 |
In QML: | personsModel |
Public Types
(since 5.93) enum | Role { FormattedNameRole, PhotoRole, PersonUriRole, PersonVCardRole, ContactsVCardRole, …, UserRole } |
Properties
- isInitialized : const bool
Public Functions
QVariant | contactCustomProperty(const QModelIndex &index, const QString &key) const |
QVariant | get(int row, int role) |
QModelIndex | indexForPersonUri(const QString &personUri) const |
bool | isInitialized() const |
Signals
void | modelInitialized(bool success) |
Detailed Description
Contacts are represented as a tree where the top level represents a "person" which is an amalgamation of all the sub-contacts
Member Type Documentation
[since 5.93]
enum PersonsModel::Role
* * *
Constant | Value | Description |
---|---|---|
KPeople::PersonsModel::FormattedNameRole | Qt::DisplayRole | * QString best name for this person * * |
KPeople::PersonsModel::PhotoRole | Qt::DecorationRole | * QPixmap best photo for this person * * |
KPeople::PersonsModel::PersonUriRole | Qt::UserRole | * QString ID of this person * * |
KPeople::PersonsModel::PersonVCardRole | 257 | * AbstractContact::Ptr * * |
KPeople::PersonsModel::ContactsVCardRole | 258 | * AbstractContact::List (FIXME or map?) * * |
KPeople::PersonsModel::GroupsRole | 259 | * QStringList * * |
KPeople::PersonsModel::PhoneNumberRole | 260 | * * |
KPeople::PersonsModel::PhotoImageProviderUri | 261 | * Provide a URL to use with QtQuick's Image.source, similar to the Photo Role. |
*
Constant | Value | Description |
---|---|---|
KPeople::PersonsModel::UserRole | Qt::UserRole + 0x1000 | * In case it's needed to extend, use this one to start from |
This enum was introduced in 5.93.
Property Documentation
[read-only]
isInitialized : const bool
Access functions:
bool | isInitialized() const |
Notifier signal:
void | modelInitialized(bool success) |
Member Function Documentation
QVariant 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
QVariant PersonsModel::get(int row, int role)
Helper class to ease model access through QML
QModelIndex PersonsModel::indexForPersonUri(const QString &personUri) const
Returns the index for a given personUri
bool PersonsModel::isInitialized() const
Returns if all the backends have been initialized yet.
Note: Getter function for property isInitialized.
[signal]
void PersonsModel::modelInitialized(bool success)
Will emit when the model is finally initialized. success will specify if it succeeded
Note: Notifier signal for property isInitialized.