1 | /* |
2 | * Copyright (C) by Klaas Freitag <freitag@kde.org> |
3 | * Copyright (C) by Olivier Goffart <ogoffart@woboq.com> |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, but |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
13 | * for more details. |
14 | */ |
15 | |
16 | #pragma once |
17 | #include <QStyledItemDelegate> |
18 | |
19 | namespace OCC { |
20 | |
21 | /** |
22 | * @brief The ActivityItemDelegate class |
23 | * @ingroup gui |
24 | */ |
25 | class ActivityItemDelegate : public QStyledItemDelegate |
26 | { |
27 | Q_OBJECT |
28 | public: |
29 | enum datarole { ActionIconRole = Qt::UserRole + 1, |
30 | UserIconRole, |
31 | AccountRole, |
32 | ActionTextRole, |
33 | PathRole, |
34 | LinkRole, |
35 | PointInTimeRole, |
36 | AccountConnectedRole }; |
37 | |
38 | void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const Q_DECL_OVERRIDE; |
39 | QSize sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const Q_DECL_OVERRIDE; |
40 | bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, |
41 | const QModelIndex &index) Q_DECL_OVERRIDE; |
42 | |
43 | static int rowHeight(); |
44 | static int iconHeight(); |
45 | |
46 | private: |
47 | static int _margin; |
48 | static int _iconHeight; |
49 | }; |
50 | |
51 | } // namespace OCC |
52 | |