digiKam
dwitemdelegatepool.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  * Copyright (C) 2015-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2007-2008 by Rafael Fernández López <ereslibre at kde dot org>
11  * Copyright (C) 2008 by Kevin Ottens <ervin at kde dot org>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_DW_ITEM_DELEGATE_POOL_H
27 #define DIGIKAM_DW_ITEM_DELEGATE_POOL_H
28 
29 // Qt includes
30 
31 #include <QModelIndex>
32 #include <QHash>
33 #include <QList>
34 
35 // Local includes
36 
37 #include "digikam_export.h"
38 
39 class QWidget;
40 class QStyleOptionViewItem;
41 
42 namespace Digikam
43 {
44 
45 class DWItemDelegate;
46 class DWItemDelegatePoolPrivate;
47 
48 class DIGIKAM_GUI_EXPORT DWItemDelegatePool
49 {
50 public:
51 
53  {
54  UpdateWidgets = 0,
55  NotUpdateWidgets
56  };
57 
58 public:
59 
65  explicit DWItemDelegatePool(DWItemDelegate* const delegate);
67 
75  QList<QWidget*> findWidgets(const QPersistentModelIndex& index, const QStyleOptionViewItem& option,
76  UpdateWidgetsEnum updateWidgets = UpdateWidgets) const;
77 
78  QList<QWidget*> invalidIndexesWidgets() const;
79 
80  void fullClear();
81 
82 private:
83 
84  // Disable
85  DWItemDelegatePool(const DWItemDelegatePool&) = delete;
86  DWItemDelegatePool& operator=(const DWItemDelegatePool&) = delete;
87 
88 private:
89 
90  friend class DWItemDelegate;
91  friend class DWItemDelegatePrivate;
92 
94 };
95 
96 // -----------------------------------------------------------------------------------------------------------
97 
98 class DWItemDelegateEventListener;
99 
101 {
102 public:
103 
104  explicit DWItemDelegatePoolPrivate(DWItemDelegate* const d);
105 
106 public:
107 
109  DWItemDelegateEventListener* eventListener;
110 
112  QHash<QPersistentModelIndex, QList<QWidget*> > usedWidgets;
113  QHash<QWidget*, QPersistentModelIndex> widgetInIndex;
114 
115  bool clearing;
116 
117 private:
118 
119  // Disable
121  DWItemDelegatePoolPrivate& operator=(const DWItemDelegatePoolPrivate&) = delete;
122 };
123 
124 } // namespace Digikam
125 
126 #endif // DIGIKAM_DW_ITEM_DELEGATE_POOL_H
Definition: dwitemdelegatepool.h:101
DWItemDelegate * delegate
Definition: dwitemdelegatepool.h:108
DWItemDelegatePoolPrivate(DWItemDelegate *const d)
Definition: dwitemdelegatepool.cpp:73
DWItemDelegateEventListener * eventListener
Definition: dwitemdelegatepool.h:109
bool clearing
Definition: dwitemdelegatepool.h:115
QHash< QPersistentModelIndex, QList< QWidget * > > usedWidgets
Definition: dwitemdelegatepool.h:112
QHash< QWidget *, QPersistentModelIndex > widgetInIndex
Definition: dwitemdelegatepool.h:113
QList< QList< QWidget * > > allocatedWidgets
Definition: dwitemdelegatepool.h:111
Definition: dwitemdelegatepool.h:49
UpdateWidgetsEnum
Definition: dwitemdelegatepool.h:53
Definition: dwitemdelegate_p.h:43
Definition: dwitemdelegate.h:60
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43