digiKam
Loading...
Searching...
No Matches
itemhistorygraphmodel.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2010-10-27
7 * Description : Model to an ItemHistoryGraph
8 *
9 * SPDX-FileCopyrightText: 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15#pragma once
16
17// Qt includes
18
19#include <QAbstractItemModel>
20
21// Local includes
22
24#include "itemhistorygraph.h"
25#include "digikam_export.h"
26
27namespace Digikam
28{
29
30class ItemHistoryGraph;
31class ItemInfo;
32class ItemListModel;
33class FilterAction;
34
35class DIGIKAM_DATABASE_EXPORT ItemHistoryGraphModel : public QAbstractItemModel,
37{
38 Q_OBJECT
39
40public:
41
42 enum Mode
43 {
46 CombinedTreeMode
47 };
48
50 {
51 IsImageItemRole = Qt::UserRole + 1000,
52 IsFilterActionItemRole = Qt::UserRole + 1001,
53 IsHeaderItemRole = Qt::UserRole + 1002,
54 IsCategoryItemRole = Qt::UserRole + 1003,
55 IsSeparatorItemRole = Qt::UserRole + 1004,
56
57 IsSubjectImageRole = Qt::UserRole + 1010,
58
59 FilterActionRole = Qt::UserRole + 1020
60 };
61
62public:
63
64 explicit ItemHistoryGraphModel(QWidget* const parent);
65 ~ItemHistoryGraphModel() override;
66
67 void setMode(Mode mode);
68 Mode mode() const;
69
74 void setHistory(const ItemInfo& subject,
75 const ItemHistoryGraph& graph = ItemHistoryGraph());
76
77 ItemInfo subject() const;
78
79 bool isImage(const QModelIndex& index) const;
80 bool hasImage(const ItemInfo& info);
81 ItemInfo imageInfo(const QModelIndex& index) const;
82
86 QModelIndex indexForInfo(const ItemInfo& info) const;
87
88 bool isFilterAction(const QModelIndex& index) const;
89 FilterAction filterAction(const QModelIndex& index) const;
90
93
94 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
95 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
96 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
97 Qt::ItemFlags flags(const QModelIndex& index) const override;
98 bool hasChildren(const QModelIndex& parent = QModelIndex()) const override;
99 QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
100 QModelIndex parent(const QModelIndex& index) const override;
101 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
102 bool setData(const QModelIndex& index, const QVariant& value, int role) override;
104
106
111 ItemListModel* imageModel() const;
112
118 QModelIndex imageModelIndex(const QModelIndex& index) const;
119
120private:
121
122 // Disable
124 ItemHistoryGraphModel& operator=(const ItemHistoryGraphModel&) = delete;
125
126private:
127
128 class Private;
129 Private* const d = nullptr;
130};
131
132} // namespace Digikam
Definition dragdropimplementations.h:30
Definition filteraction.h:33
Definition itemhistorygraphmodel.h:37
ExtraRoles
Definition itemhistorygraphmodel.h:50
Mode
Definition itemhistorygraphmodel.h:43
@ ImagesTreeMode
Definition itemhistorygraphmodel.h:45
@ ImagesListMode
Definition itemhistorygraphmodel.h:44
Definition itemhistorygraph.h:36
Definition iteminfo.h:68
Definition itemlistmodel.h:29
#define DECLARE_MODEL_DRAG_DROP_METHODS
Definition dragdropimplementations.h:80
qulonglong value
Definition itemviewutilities.cpp:585
Definition datefolderview.cpp:34