digiKam
Loading...
Searching...
No Matches
rgtagmodel.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-05-12
7 * Description : A model to hold information about image tags.
8 *
9 * SPDX-FileCopyrightText: 2010 by Michael G. Hansen <mike at mghansen dot de>
10 * SPDX-FileCopyrightText: 2010 by Gabriel Voicu <ping dot gabi at gmail dot com>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QAbstractItemModel>
21#include <QItemSelectionModel>
22
23// Local includes
24
25#include "gpsitemcontainer.h"
26#include "treebranch.h"
27#include "digikam_export.h"
28
29namespace Digikam
30{
31
42class DIGIKAM_EXPORT RGTagModel : public QAbstractItemModel
43{
44 Q_OBJECT
45
46public:
47
53 explicit RGTagModel(QAbstractItemModel* const externalTagModel,
54 QObject* const parent = nullptr);
55
59 ~RGTagModel() override;
60
62
63 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
64 bool setData(const QModelIndex& index, const QVariant& value, int role) override;
65 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
66 QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
67 QModelIndex parent(const QModelIndex& index) const override;
68 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
69 bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role) override;
70 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
71 Qt::ItemFlags flags(const QModelIndex& index) const override;
72
74
79 QModelIndex fromSourceIndex(const QModelIndex& externalTagModelIndex) const;
80
85 QModelIndex toSourceIndex(const QModelIndex& tagModelIndex) const;
86
92 void addSpacerTag(const QModelIndex& parent, const QString& spacerName);
93
99 QPersistentModelIndex addNewTag(const QModelIndex& parent,
100 const QString& newTagName,
101 const QString& newElement);
102
111 QList<QList<TagData> > addNewData(const QStringList& elements, const QStringList& resultedData);
112
121 void addDataInTree(TreeBranch* currentBranch,
122 int currentRow,
123 const QStringList& addressElements,
124 const QStringList& elementsData);
125
129 QList<TagData> getTagAddress();
130
137 void findAndDeleteSpacersOrNewTags(TreeBranch* currentBranch,
138 int currentRow,
139 Type whatShouldRemove);
140
146 void deleteAllSpacersOrNewTags(const QModelIndex& currentIndex, Type whatShouldRemove);
147
160 void readdTag(TreeBranch*& currentBranch,
161 int currentRow,
162 const QList<TagData>& tagAddressElements,
163 int currentAddressElementIndex);
164
169 void readdNewTags(const QList<QList<TagData> >& tagAddressList);
170
175 void deleteTag(const QModelIndex& currentIndex);
176
181 QList<QList<TagData> > getSpacers();
182
187 void climbTreeAndGetSpacers(const TreeBranch* currentBranch);
188
194 QList<TagData> getSpacerAddress(TreeBranch* currentBranch);
195
201 void addExternalTags(TreeBranch* parentBranch, int currentRow);
202
206 void addAllExternalTagsToTreeView();
207
211 void addAllSpacersToTag(const QModelIndex& currentIndex,
212 const QStringList& spacerList,
213 int spacerListIndex);
214
220 Type getTagType(const QModelIndex& index) const;
221
227 TreeBranch* branchFromIndex(const QModelIndex& index) const;
228
229public Q_SLOTS:
230
231 void slotSourceDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
232 void slotSourceHeaderDataChanged(const Qt::Orientation orientation, int first, int last);
233 void slotColumnsAboutToBeInserted(const QModelIndex& parent, int start, int end);
234 void slotColumnsAboutToBeMoved(const QModelIndex& sourceParent, int sourceStart, int sourceEnd,
235 const QModelIndex& destinationParent, int destinationColumn);
236 void slotColumnsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
237 void slotColumnsInserted();
238 void slotColumnsMoved();
239 void slotColumnsRemoved();
240 void slotLayoutAboutToBeChanged();
241 void slotLayoutChanged();
242 void slotModelAboutToBeReset();
243 void slotModelReset();
244 void slotRowsAboutToBeInserted(const QModelIndex& parent, int start, int end);
245 void slotRowsAboutToBeMoved(const QModelIndex& sourceParent, int sourceStart, int sourceEnd,
246 const QModelIndex& destinationParent, int destinationRow);
247 void slotRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
248 void slotRowsInserted();
249 void slotRowsMoved();
250 void slotRowsRemoved();
251
252private:
253
254 QString translateSpacer(const QString& text) const;
255
256private:
257
258 class Private;
259 Private* const d = nullptr;
260};
261
262} // namespace Digikam
The model that holds data for the tag tree displayed in ReverseGeocodingWidget.
Definition rgtagmodel.h:43
Definition treebranch.h:31
qulonglong value
Definition itemviewutilities.cpp:585
Definition datefolderview.cpp:34
Type
Definition gpsitemcontainer.h:36