Warning, file /frameworks/kwidgetsaddons/src/kpagewidgetmodel_p.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef KPAGEWIDGETMODEL_P_H 0009 #define KPAGEWIDGETMODEL_P_H 0010 0011 #include "kpagemodel_p.h" 0012 #include "kpagewidgetmodel.h" 0013 0014 class PageItem 0015 { 0016 public: 0017 explicit PageItem(KPageWidgetItem *pageItem, PageItem *parent = nullptr); 0018 ~PageItem(); 0019 0020 PageItem(const PageItem &) = delete; 0021 PageItem &operator=(const PageItem &) = delete; 0022 0023 void appendChild(PageItem *child); 0024 void insertChild(int row, PageItem *child); 0025 void removeChild(int row); 0026 0027 PageItem *child(int row); 0028 int childCount() const; 0029 int columnCount() const; 0030 int row() const; 0031 PageItem *parent(); 0032 0033 KPageWidgetItem *pageWidgetItem() const; 0034 0035 PageItem *findChild(const KPageWidgetItem *item); 0036 0037 void dump(int indent = 0); 0038 0039 private: 0040 KPageWidgetItem *mPageWidgetItem; 0041 0042 QList<PageItem *> mChildItems; 0043 PageItem *mParentItem; 0044 }; 0045 0046 class KPageWidgetModelPrivate : public KPageModelPrivate 0047 { 0048 Q_DECLARE_PUBLIC(KPageWidgetModel) 0049 protected: 0050 KPageWidgetModelPrivate() 0051 : rootItem(new PageItem(nullptr, nullptr)) 0052 { 0053 } 0054 0055 ~KPageWidgetModelPrivate() override 0056 { 0057 delete rootItem; 0058 rootItem = nullptr; 0059 } 0060 0061 PageItem *rootItem; 0062 0063 void _k_itemChanged() 0064 { 0065 Q_Q(KPageWidgetModel); 0066 KPageWidgetItem *item = qobject_cast<KPageWidgetItem *>(q->sender()); 0067 if (!item) { 0068 return; 0069 } 0070 0071 const QModelIndex index = q->index(item); 0072 if (!index.isValid()) { 0073 return; 0074 } 0075 0076 Q_EMIT q->dataChanged(index, index); 0077 } 0078 0079 void _k_itemToggled(bool checked) 0080 { 0081 Q_Q(KPageWidgetModel); 0082 KPageWidgetItem *item = qobject_cast<KPageWidgetItem *>(q->sender()); 0083 if (!item) { 0084 return; 0085 } 0086 0087 Q_EMIT q->toggled(item, checked); 0088 } 0089 }; 0090 0091 #endif // KPAGEWIDGETMODEL_P_H