2
* This file is part of the KDE project
3
* Copyright (C) 2008 Rafael Fernández López <ereslibre@kde.org>
4
* Copyright (C) 2008 Kevin Ottens <ervin@kde.org>
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public License
17
* along with this library; see the file COPYING.LIB. If not, write to
18
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301, USA.
22
#ifndef KWIDGETITEMDELEGATEPOOL_P_H
23
#define KWIDGETITEMDELEGATEPOOL_P_H
25
#include <QtCore/QModelIndex>
26
#include <QtCore/QHash>
27
#include <QtCore/QList>
30
class QStyleOptionViewItem;
31
class KWidgetItemDelegate;
32
class KWidgetItemDelegatePoolPrivate;
37
class KWidgetItemDelegatePool
40
enum UpdateWidgetsEnum {
46
* Creates a new ItemDelegatePool.
48
* @param delegate the ItemDelegate for this pool.
51
KWidgetItemDelegatePool(KWidgetItemDelegate *delegate);
54
* Destroys an ItemDelegatePool.
56
~KWidgetItemDelegatePool();
59
* @brief Returns the widget associated to @p index and @p widget
60
* @param index The index to search into.
61
* @param option a QStyleOptionViewItem.
62
* @return A QList of the pointers to the widgets found.
65
QList<QWidget *> findWidgets(const QPersistentModelIndex &index, const QStyleOptionViewItem &option,
66
UpdateWidgetsEnum updateWidgets = UpdateWidgets) const;
71
QList<QWidget *> invalidIndexesWidgets() const;
79
friend class KWidgetItemDelegate;
80
friend class KWidgetItemDelegatePrivate;
81
KWidgetItemDelegatePoolPrivate *const d;
84
class KWidgetItemDelegateEventListener;
89
class KWidgetItemDelegatePoolPrivate
93
KWidgetItemDelegatePoolPrivate(KWidgetItemDelegate *d);
95
KWidgetItemDelegate *delegate;
96
KWidgetItemDelegateEventListener *eventListener;
98
QList<QList<QWidget *> > allocatedWidgets;
99
QHash<QPersistentModelIndex, QList<QWidget *> > usedWidgets;
100
QHash<QWidget *, QPersistentModelIndex> widgetInIndex;