25 #ifndef DIGIKAM_SETUP_COLLECTION_VIEW_H
26 #define DIGIKAM_SETUP_COLLECTION_VIEW_H
30 #include <QAbstractItemModel>
31 #include <QAbstractItemDelegate>
34 #include <QStyledItemDelegate>
35 #include <QPushButton>
36 #include <QToolButton>
63 IsCategoryRole = Qt::UserRole,
66 CategoryButtonDisplayRole = Qt::UserRole + 1,
67 CategoryButtonMapId = Qt::UserRole + 2,
70 IsUpdateRole = Qt::UserRole + 3,
73 UpdateDecorationRole = Qt::UserRole + 4,
74 UpdateMapId = Qt::UserRole + 5,
77 IsDeleteRole = Qt::UserRole + 6,
80 DeleteDecorationRole = Qt::UserRole + 7,
81 DeleteMapId = Qt::UserRole + 8
89 ColumnUpdateButton = 3,
90 ColumnDeleteButton = 4,
97 CategoryRemovable = 1,
108 void loadCollections();
111 void setParentWidgetForDialogs(QWidget*
const widget);
116 QModelIndex indexForCategory(
Category category)
const;
120 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
121 QVariant headerData(
int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
122 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
123 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
124 Qt::ItemFlags flags(
const QModelIndex& index)
const override;
125 bool setData(
const QModelIndex& index,
const QVariant&
value,
int role = Qt::EditRole)
override;
126 QModelIndex index(
int row,
int column,
const QModelIndex& parent = QModelIndex())
const override;
127 QModelIndex parent(
const QModelIndex& index)
const override;
148 void slotCategoryButtonPressed(
int mappedId);
155 void slotUpdatePressed(
int mappedId);
156 void slotDeletePressed(
int mappedId);
160 void addCollection(
int category);
161 void updateCollection(
int internalId);
162 void deleteCollection(
int internalId);
166 QModelIndex indexForId(
int id,
int column)
const;
168 bool askForNewCollectionPath(
int category, QString*
const newPath, QString*
const newLabel);
169 bool askForNewCollectionCategory(
int*
const category);
171 int categoryButtonMapId(
const QModelIndex& index)
const;
172 int buttonMapId(
const QModelIndex& index)
const;
220 void setModel(QAbstractItemModel* model)
override
235 QObject*
const parent =
nullptr);
239 const QStyleOptionViewItem& option,
240 const QModelIndex& index)
const override;
243 QAbstractItemModel* model,
244 const QStyleOptionViewItem& option,
245 const QModelIndex& index)
override;
247 void paint(QPainter* painter,
248 const QStyleOptionViewItem& option,
249 const QModelIndex& index)
const override;
252 const QModelIndex& index)
const override;
255 QAbstractItemModel* model,
256 const QModelIndex& index)
const override;
258 QSize
sizeHint(
const QStyleOptionViewItem& option,
259 const QModelIndex& index)
const override;
262 const QStyleOptionViewItem& option,
263 const QModelIndex& index)
const override;
267 const QStyleOptionViewItem& option,
268 const QPersistentModelIndex& index)
const override;
Definition: collectionlocation.h:41
Type
Definition: collectionlocation.h:80
Definition: dwitemdelegate.h:60
Definition: setupcollectionview.h:229
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: setupcollectionview.cpp:260
QList< QWidget * > createItemWidgets(const QModelIndex &index) const override
Definition: setupcollectionview.cpp:99
void updatePressed(int mappedId) const
void categoryButtonPressed(int mappedId) const
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
Definition: setupcollectionview.cpp:270
int m_categoryMaxStyledWidth
Definition: setupcollectionview.h:283
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
Definition: setupcollectionview.cpp:254
void updateItemWidgets(const QList< QWidget * > &widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const override
Definition: setupcollectionview.cpp:191
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: setupcollectionview.cpp:275
QStyledItemDelegate * m_styledDelegate
Definition: setupcollectionview.h:278
void deletePressed(int mappedId) const
QPushButton * m_samplePushButton
Definition: setupcollectionview.h:280
~SetupCollectionDelegate() override
Definition: setupcollectionview.cpp:95
QToolButton * m_sampleUpdateButton
Definition: setupcollectionview.h:281
void setEditorData(QWidget *editor, const QModelIndex &index) const override
Definition: setupcollectionview.cpp:265
QToolButton * m_sampleDeleteButton
Definition: setupcollectionview.h:282
SetupCollectionDelegate(QAbstractItemView *const view, QObject *const parent=nullptr)
Definition: setupcollectionview.cpp:65
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: setupcollectionview.cpp:130
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: setupcollectionview.cpp:249
Definition: setupcollectionview.h:179
QString path
Definition: setupcollectionview.h:190
QString label
Definition: setupcollectionview.h:189
CollectionLocation location
Definition: setupcollectionview.h:188
bool updated
Definition: setupcollectionview.h:192
int parentId
Definition: setupcollectionview.h:191
bool deleted
Definition: setupcollectionview.h:193
Definition: setupcollectionview.h:48
Category
Definition: setupcollectionview.h:95
SetupCollectionDataRole
Definition: setupcollectionview.h:61
void collectionsLoaded()
Emitted when all collections were loaded and the model reset in loadCollections.
QList< Item > m_collections
Definition: setupcollectionview.h:198
Columns
Definition: setupcollectionview.h:85
QWidget * m_dialogParentWidget
Definition: setupcollectionview.h:199
Definition: setupcollectionview.h:205
void modelLoadedCollections()
Definition: setupcollectionview.cpp:324
SetupCollectionTreeView(QWidget *const parent=nullptr)
Definition: setupcollectionview.cpp:282
void setModel(SetupCollectionModel *model)
Definition: setupcollectionview.cpp:294
qulonglong value
Definition: itemviewutilities.cpp:592
@ Orientation
Definition: coredbfields.h:86
Category
Definition: coredbconstants.h:95
std::vector< T > location(const std::vector< T > &shape, unsigned long idx)
Definition: shapepredictor.h:109
Definition: datefolderview.cpp:43