digiKam
Loading...
Searching...
No Matches
dwitemdelegate.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 : 2007-11-15
7 * Description : widget item delegate for setup collection view
8 *
9 * SPDX-FileCopyrightText: 2015-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2007-2008 by Rafael Fernández López <ereslibre at kde dot org>
11 * SPDX-FileCopyrightText: 2008 by Kevin Ottens <ervin at kde dot org>
12 *
13 * SPDX-License-Identifier: GPL-2.0-or-later
14 *
15 * ============================================================ */
16
17#pragma once
18
19// Qt includes
20
21#include <QEvent>
22#include <QList>
23#include <QPersistentModelIndex>
24#include <QAbstractItemDelegate>
25
26// Local includes
27
28#include "dwitemdelegate_p.h"
29#include "digikam_export.h"
30
31class QObject;
32class QPainter;
33class QStyleOption;
34class QStyleOptionViewItem;
35class QAbstractItemView;
36class QItemSelection;
37
38namespace Digikam
39{
40
41class DWItemDelegatePool;
42class DWItemDelegatePrivate;
43
49class DIGIKAM_GUI_EXPORT DWItemDelegate : public QAbstractItemDelegate
50{
51 Q_OBJECT
52
53public:
54
61 explicit DWItemDelegate(QAbstractItemView* const itemView, QObject* const parent = nullptr);
62 ~DWItemDelegate() override;
63
69 QAbstractItemView* itemView() const;
70
76 QPersistentModelIndex focusedIndex() const;
77
78protected:
79
99 virtual QList<QWidget*> createItemWidgets(const QModelIndex& index) const = 0;
100
114 virtual void updateItemWidgets(const QList<QWidget*>& widgets,
115 const QStyleOptionViewItem& option,
116 const QPersistentModelIndex& index) const = 0;
117
127 void setBlockedEventTypes(QWidget* const widget, const QList<QEvent::Type>& types) const;
128
136 QList<QEvent::Type> blockedEventTypes(QWidget* const widget) const;
137
138private:
139
140 friend class DWItemDelegatePool;
141 friend class DWItemDelegateEventListener;
142
143 DWItemDelegatePrivate* const d = nullptr;
144
145 Q_PRIVATE_SLOT(d, void slotDWRowsInserted(const QModelIndex&, int, int))
146 Q_PRIVATE_SLOT(d, void slotDWRowsAboutToBeRemoved(const QModelIndex&, int, int))
147 Q_PRIVATE_SLOT(d, void slotDWRowsRemoved(const QModelIndex&, int, int))
148 Q_PRIVATE_SLOT(d, void slotDWDataChanged(const QModelIndex&, const QModelIndex&))
149 Q_PRIVATE_SLOT(d, void slotDWLayoutChanged())
150 Q_PRIVATE_SLOT(d, void slotDWModelReset())
151 Q_PRIVATE_SLOT(d, void slotDWSelectionChanged(const QItemSelection&, const QItemSelection&))
152};
153
154} // namespace Digikam
155
156Q_DECLARE_METATYPE(QList<QEvent::Type>)
Definition dwitemdelegatepool.h:39
Definition dwitemdelegate_p.h:33
Definition dwitemdelegate.h:50
virtual void updateItemWidgets(const QList< QWidget * > &widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const =0
virtual QList< QWidget * > createItemWidgets(const QModelIndex &index) const =0
Definition datefolderview.cpp:34
Type
Definition gpsitemcontainer.h:36