Eventviews

tododelegates.h
1/*
2 This file is part of KOrganizer.
3
4 SPDX-FileCopyrightText: 2008 Thomas Thrainer <tom_t@gmx.at>
5
6 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
7*/
8
9#pragma once
10
11#include <QStyledItemDelegate>
12
13class QPainter;
14class QSize;
16class QTextDocument;
17
18/**
19 This delegate is responsible for displaying progress bars for the completion
20 status of indivitual todos. It also provides a slider to change the completion
21 status of the todo when in editing mode.
22
23 @author Thomas Thrainer
24*/
26{
28public:
29 explicit TodoCompleteDelegate(QObject *parent = nullptr);
30
31 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
32 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
33
34 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
35 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
36 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
37 void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
38
39private:
40 void initStyleOptionProgressBar(QStyleOptionProgressBar *option, const QModelIndex &index) const;
41};
42
43class TodoCompleteSlider : public QSlider
44{
46
47public:
48 explicit TodoCompleteSlider(QWidget *parent);
49
50private Q_SLOTS:
51 void updateTip(int value);
52};
53
54/**
55 This delegate is responsible for displaying the priority of todos.
56 It also provides a combo box to change the priority of the todo
57 when in editing mode.
58
59 @author Thomas Thrainer
60 */
62{
64public:
65 explicit TodoPriorityDelegate(QObject *parent = nullptr);
66
67 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
68 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
69 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
70 void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
71};
72
73/**
74 This delegate is responsible for displaying the due date of todos.
75 It also provides a combo box to change the due date of the todo
76 when in editing mode.
77
78 @author Thomas Thrainer
79 */
81{
83public:
84 explicit TodoDueDateDelegate(QObject *parent = nullptr);
85
86 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
87 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
88 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
89 void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
90};
91
92/**
93 This delegate is responsible for displaying the categories of todos.
94 It also provides a combo box to change the categories of the todo
95 when in editing mode.
96
97 @author Thomas Thrainer
98 */
100{
102public:
103 explicit TodoCategoriesDelegate(QObject *parent = nullptr);
104
105 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
106 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
107 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
108 void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
109};
110
111/**
112 This delegate is responsible for displaying possible rich text elements
113 of a todo. That's the summary and the description.
114
115 @author Thomas Thrainer
116 */
118{
120public:
121 explicit TodoRichTextDelegate(QObject *parent = nullptr);
122
123 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
124 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
125
126private:
127 QTextDocument *m_textDoc = nullptr;
128};
This delegate is responsible for displaying the categories of todos.
This delegate is responsible for displaying progress bars for the completion status of indivitual tod...
This delegate is responsible for displaying the due date of todos.
This delegate is responsible for displaying the priority of todos.
This delegate is responsible for displaying possible rich text elements of a todo.
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
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:57:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.