Incidenceeditor

attendeecomboboxdelegate.h
1/*
2 * SPDX-FileCopyrightText: 2014 Sandro Knauß <knauss@kolabsys.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
5 */
6
7#pragma once
8
9#include <QIcon>
10#include <QModelIndex>
11#include <QString>
12#include <QStyledItemDelegate>
13
14namespace IncidenceEditorNG
15{
16/**
17 * class to show a Icon and Text for an Attendee
18 * you have to set the Items via addItem to have a list to choose from.
19 * saves the option as int in the model
20 */
22{
24public:
25 explicit AttendeeComboBoxDelegate(QObject *parent = nullptr);
26
27 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
28 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
29 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
30 void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
31 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
32
33 bool eventFilter(QObject *editor, QEvent *event) override;
34
35 virtual void addItem(const QIcon &, const QString &);
36 virtual void clear();
37
38 virtual void setToolTip(const QString &);
39 virtual void setWhatsThis(const QString &);
40
41 /** choose this index, if the item in the model is unknown
42 */
43 void setStandardIndex(int);
44
45public Q_SLOTS:
46 bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index) override;
47
48private:
49 void doCloseEditor(QWidget *editor);
50 void rightPressed();
51 void leftPressed();
52 /** all entries to choose from */
54 QString mToolTip;
55 QString mWhatsThis;
56 /**fallback index */
57 int mStandardIndex = 0;
58};
59}
class to show a Icon and Text for an Attendee you have to set the Items via addItem to have a list to...
void setStandardIndex(int)
choose this index, if the item in the model is unknown
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
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 Sat Dec 21 2024 16:58:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.