| 1 | /* |
| 2 | This file is part of the KDE project |
| 3 | SPDX-FileCopyrightText: 2008 Rafael Fernández López <ereslibre@kde.org> |
| 4 | SPDX-FileCopyrightText: 2008 Kevin Ottens <ervin@kde.org> |
| 5 | |
| 6 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | /* |
| 10 | * This class is necessary to be installed because of the templated method. |
| 11 | * It is private in the sense of having clean the public header. |
| 12 | * Do not forget that this file _has_ to be installed. |
| 13 | */ |
| 14 | |
| 15 | #ifndef KWIDGETITEMDELEGATE_P_H |
| 16 | #define KWIDGETITEMDELEGATE_P_H |
| 17 | |
| 18 | #include <QItemSelectionModel> |
| 19 | |
| 20 | class KWidgetItemDelegate; |
| 21 | |
| 22 | class KWidgetItemDelegatePrivate : public QObject |
| 23 | { |
| 24 | Q_OBJECT |
| 25 | |
| 26 | public: |
| 27 | explicit KWidgetItemDelegatePrivate(KWidgetItemDelegate *q, QObject *parent = nullptr); |
| 28 | ~KWidgetItemDelegatePrivate() override; |
| 29 | |
| 30 | void _k_slotRowsInserted(const QModelIndex &parent, int start, int end); |
| 31 | void _k_slotRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); |
| 32 | void _k_slotRowsRemoved(const QModelIndex &parent, int start, int end); |
| 33 | void _k_slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); |
| 34 | void _k_slotLayoutChanged(); |
| 35 | void _k_slotModelReset(); |
| 36 | void _k_slotSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); |
| 37 | |
| 38 | void updateRowRange(const QModelIndex &parent, int start, int end, bool isRemoving); |
| 39 | QStyleOptionViewItem optionView(const QModelIndex &index); |
| 40 | |
| 41 | public Q_SLOTS: |
| 42 | void initializeModel(const QModelIndex &parent = QModelIndex()); |
| 43 | |
| 44 | protected: |
| 45 | bool eventFilter(QObject *watched, QEvent *event) override; |
| 46 | |
| 47 | public: |
| 48 | QAbstractItemView *itemView = nullptr; |
| 49 | KWidgetItemDelegatePool *const widgetPool; |
| 50 | QAbstractItemModel *model = nullptr; |
| 51 | QItemSelectionModel *selectionModel = nullptr; |
| 52 | bool viewDestroyed = false; |
| 53 | |
| 54 | KWidgetItemDelegate *const q; |
| 55 | }; |
| 56 | |
| 57 | #endif |
| 58 | |