File indexing completed on 2024-04-21 03:56:17

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2008 Rafael Fernández López <ereslibre@kde.org>
0004     SPDX-FileCopyrightText: 2008 Kevin Ottens <ervin@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 /**
0010  * This class is necessary to be installed because of the templated method.
0011  * It is private in the sense of having clean the public header.
0012  * Do not forget that this file _has_ to be installed.
0013  */
0014 
0015 #ifndef KWIDGETITEMDELEGATE_P_H
0016 #define KWIDGETITEMDELEGATE_P_H
0017 
0018 #include <QItemSelectionModel>
0019 
0020 class KWidgetItemDelegate;
0021 
0022 class KWidgetItemDelegatePrivate : public QObject
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     explicit KWidgetItemDelegatePrivate(KWidgetItemDelegate *q, QObject *parent = nullptr);
0028     ~KWidgetItemDelegatePrivate() override;
0029 
0030     void _k_slotRowsInserted(const QModelIndex &parent, int start, int end);
0031     void _k_slotRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
0032     void _k_slotRowsRemoved(const QModelIndex &parent, int start, int end);
0033     void _k_slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
0034     void _k_slotLayoutChanged();
0035     void _k_slotModelReset();
0036     void _k_slotSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
0037 
0038     void updateRowRange(const QModelIndex &parent, int start, int end, bool isRemoving);
0039     QStyleOptionViewItem optionView(const QModelIndex &index);
0040 
0041 public Q_SLOTS:
0042     void initializeModel(const QModelIndex &parent = QModelIndex());
0043 
0044 protected:
0045     bool eventFilter(QObject *watched, QEvent *event) override;
0046 
0047 public:
0048     QAbstractItemView *itemView = nullptr;
0049     KWidgetItemDelegatePool *const widgetPool;
0050     QAbstractItemModel *model = nullptr;
0051     QItemSelectionModel *selectionModel = nullptr;
0052     bool viewDestroyed = false;
0053 
0054     KWidgetItemDelegate *const q;
0055 };
0056 
0057 #endif