Akonadi Contacts

customfieldslistdelegate.h
1 /*
2  This file is part of Contact Editor.
3 
4  SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org>
5  SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #pragma once
11 
12 #include <QStyledItemDelegate>
13 class QAbstractItemView;
14 namespace Akonadi
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  const QSize mButtonSize;
36  QAbstractItemView *const mItemView;
37 };
38 }
Q_OBJECTQ_OBJECT
A widget for editing the display name of a contact.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 04:00:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.