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>
14namespace Akonadi
15{
16class CustomFieldsListDelegate : public QStyledItemDelegate
17{
19public:
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
31private:
32 void setFirstColumnAsCurrent();
33 void removeField(int row, QAbstractItemModel *model);
34 const QIcon mIcon;
35 const QSize mButtonSize;
36 QAbstractItemView *const mItemView;
37};
38}
A widget for editing the display name of a contact.
Q_OBJECTQ_OBJECT
virtual bool event(QEvent *e)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:36:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.