Akonadi Contacts

customfieldsmodel.h
1 /*
2  This file is part of Contact Editor.
3 
4  SPDX-FileCopyrightText: 2010 Tobias Koenig <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #pragma once
10 
11 #include "customfields_p.h"
12 
13 #include <QAbstractItemModel>
14 
15 class CustomFieldsModel : public QAbstractItemModel
16 {
17  Q_OBJECT
18 public:
19  enum Role { TypeRole = Qt::UserRole, ScopeRole };
20 
21  explicit CustomFieldsModel(QObject *parent = nullptr);
22  ~CustomFieldsModel() override;
23 
24  void setCustomFields(const CustomField::List &addresses);
25  CustomField::List customFields() const;
26 
27  QModelIndex index(int row, int col, const QModelIndex &parent = QModelIndex()) const override;
28  QModelIndex parent(const QModelIndex &child) const override;
29  QVariant data(const QModelIndex &index, int role) const override;
30  bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
31  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
32  Qt::ItemFlags flags(const QModelIndex &index) const override;
33  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
34  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
35 
36  bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
37  bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
38 
39 private:
40  CustomField::List mCustomFields;
41 };
42 
virtual int rowCount(const QModelIndex &parent) const const =0
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const =0
virtual bool insertRows(int row, int count, const QModelIndex &parent)
Q_OBJECTQ_OBJECT
UserRole
virtual QVariant data(const QModelIndex &index, int role) const const =0
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const const
virtual bool removeRows(int row, int count, const QModelIndex &parent)
virtual int columnCount(const QModelIndex &parent) const const =0
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
virtual Qt::ItemFlags flags(const QModelIndex &index) const const
Orientation
QObject * parent() const const
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jun 23 2021 23:09:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.