42class DIGIKAM_EXPORT
RGTagModel :
public QAbstractItemModel
53 explicit RGTagModel(QAbstractItemModel*
const externalTagModel,
54 QObject*
const parent =
nullptr);
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;
79 QModelIndex fromSourceIndex(
const QModelIndex& externalTagModelIndex)
const;
85 QModelIndex toSourceIndex(
const QModelIndex& tagModelIndex)
const;
92 void addSpacerTag(
const QModelIndex& parent,
const QString& spacerName);
99 QPersistentModelIndex addNewTag(
const QModelIndex& parent,
100 const QString& newTagName,
101 const QString& newElement);
111 QList<QList<TagData> > addNewData(
const QStringList& elements,
const QStringList& resultedData);
123 const QStringList& addressElements,
124 const QStringList& elementsData);
129 QList<TagData> getTagAddress();
137 void findAndDeleteSpacersOrNewTags(
TreeBranch* currentBranch,
139 Type whatShouldRemove);
146 void deleteAllSpacersOrNewTags(
const QModelIndex& currentIndex,
Type whatShouldRemove);
162 const QList<TagData>& tagAddressElements,
163 int currentAddressElementIndex);
169 void readdNewTags(
const QList<QList<TagData> >& tagAddressList);
175 void deleteTag(
const QModelIndex& currentIndex);
181 QList<QList<TagData> > getSpacers();
187 void climbTreeAndGetSpacers(
const TreeBranch* currentBranch);
194 QList<TagData> getSpacerAddress(
TreeBranch* currentBranch);
201 void addExternalTags(
TreeBranch* parentBranch,
int currentRow);
206 void addAllExternalTagsToTreeView();
211 void addAllSpacersToTag(
const QModelIndex& currentIndex,
212 const QStringList& spacerList,
213 int spacerListIndex);
220 Type getTagType(
const QModelIndex& index)
const;
227 TreeBranch* branchFromIndex(
const QModelIndex& index)
const;
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();
254 QString translateSpacer(
const QString& text)
const;
259 Private*
const d =
nullptr;