Akonadi::ContactsFilterProxyModel Class
A proxy model for ContactsTreeModel models. More...
| Header: | #include <Akonadi/ContactsFilterProxyModel> |
| CMake: | find_package(KPim6AkonadiContactCore REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::AkonadiContactCore) |
| Inherits: | QSortFilterProxyModel |
Public Functions
| ContactsFilterProxyModel(QObject *parent = nullptr) | |
| virtual | ~ContactsFilterProxyModel() override |
| void | setExcludeVirtualCollections(bool exclude) |
| void | setFilterFlags(ContactsFilterProxyModel::FilterFlags flags) |
| void | setMatchFilterContactFlag(Akonadi::ContactsFilterProxyModel::MatchFilterContactFlag flag) |
Reimplemented Public Functions
| virtual Qt::ItemFlags | flags(const QModelIndex &index) const override |
Public Slots
| void | setFilterString(const QString &filter) |
Detailed Description
This class provides a filter proxy model for a ContactsTreeModel. The list of shown contacts or contact groups can be limited by settings a filter pattern. Only contacts or contact groups that contain this pattern as part of their data will be listed.
Example:
Akonadi::ContactsTreeModel *model = new Akonadi::ContactsTreeModel( ... );
Akonadi::ContactsFilterProxyModel *filter = new Akonadi::ContactsFilterProxyModel;
filter->setSourceModel( model );
Akonadi::EntityTreeView *view = new Akonadi::EntityTreeView;
view->setModel( filter );
QLineEdit *filterEdit = new QLineEdit;
connect( filterEdit, SIGNAL(textChanged(QString)),
filter, SLOT(setFilterString(QString)) );
Author: Tobias Koenig <tokoe@kde.org>
Member Function Documentation
[explicit] ContactsFilterProxyModel::ContactsFilterProxyModel(QObject *parent = nullptr)
Creates a new contacts filter proxy model.
parent The parent object.
[override virtual noexcept] ContactsFilterProxyModel::~ContactsFilterProxyModel()
Destroys the contacts filter proxy model.
[override virtual] Qt::ItemFlags ContactsFilterProxyModel::flags(const QModelIndex &index) const
Reimplements: QSortFilterProxyModel::flags(const QModelIndex &index) const.
void ContactsFilterProxyModel::setExcludeVirtualCollections(bool exclude)
Sets whether we want virtual collections to be filtered or not. By default, virtual collections are accepted.
exclude If true, virtual collections aren't accepted.
void ContactsFilterProxyModel::setFilterFlags(ContactsFilterProxyModel::FilterFlags flags)
Sets the filter flags. By default ContactsFilterProxyModel::FilterString is set. flags the filter flags to set
[slot] void ContactsFilterProxyModel::setFilterString(const QString &filter)
Sets the filter that is used to filter for matching contacts and contact groups.
void ContactsFilterProxyModel::setMatchFilterContactFlag(Akonadi::ContactsFilterProxyModel::MatchFilterContactFlag flag)
setMatchFilterContactFlag flag