Akonadi Contacts

customfieldslistdelegate.h
1 /*
2  This file is part of Contact Editor.
3 
4  SPDX-FileCopyrightText: 2010 Tobias Koenig <[email protected]>
5  SPDX-FileCopyrightText: 2016-2021 Laurent Montel <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #pragma once
11 
12 #include <QStyledItemDelegate>
13 class QAbstractItemView;
14 namespace ContactEditor
15 {
16 class CustomFieldsListDelegate : public QStyledItemDelegate
17 {
18  Q_OBJECT
19 public:
20  explicit CustomFieldsListDelegate(QAbstractItemView *view, QObject *parent = nullptr);
21  ~CustomFieldsListDelegate() override;
22 
23  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
24 
25  void setEditorData(QWidget *editor, const QModelIndex &index) const override;
26  void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
27  void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
28  QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
29  bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
30 
31 private:
32  void setFirstColumnAsCurrent();
33  void removeField(int row, QAbstractItemModel *model);
34  const QIcon mIcon;
35  QSize mButtonSize;
36  QAbstractItemView *const mItemView;
37 };
38 }
Q_OBJECTQ_OBJECT
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.