File indexing completed on 2024-05-12 11:55:20
0001 /* 0002 SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "kconcatenaterowsproxymodel_qml.h" 0008 0009 #include "qmldeprecated.h" 0010 0011 #if KITEMMODELS_BUILD_DEPRECATED_SINCE(5, 80) 0012 0013 KConcatenateRowsProxyModelQml::KConcatenateRowsProxyModelQml(QObject *wrappedObject) 0014 : QObject(wrappedObject) 0015 , q(qobject_cast<KConcatenateRowsProxyModel *>(wrappedObject)){QML_DEPRECATED("KConcatenateRowsProxyModelQml", "5.80", "No known users.")} 0016 0017 KConcatenateRowsProxyModelQml::~KConcatenateRowsProxyModelQml() 0018 { 0019 } 0020 0021 QQmlListProperty<QAbstractItemModel> KConcatenateRowsProxyModelQml::sources() 0022 { 0023 return QQmlListProperty<QAbstractItemModel>(this, 0024 q, 0025 &KConcatenateRowsProxyModelQml::appendSource, 0026 &KConcatenateRowsProxyModelQml::sourceCount, 0027 &KConcatenateRowsProxyModelQml::source, 0028 &KConcatenateRowsProxyModelQml::clear); 0029 } 0030 0031 void KConcatenateRowsProxyModelQml::appendSource(QQmlListProperty<QAbstractItemModel> *list, QAbstractItemModel *newItem) 0032 { 0033 auto q = static_cast<KConcatenateRowsProxyModel *>(list->data); 0034 q->addSourceModel(newItem); 0035 } 0036 0037 int KConcatenateRowsProxyModelQml::sourceCount(QQmlListProperty<QAbstractItemModel> *list) 0038 { 0039 auto q = static_cast<KConcatenateRowsProxyModel *>(list->data); 0040 return q->sources().count(); 0041 } 0042 0043 QAbstractItemModel *KConcatenateRowsProxyModelQml::source(QQmlListProperty<QAbstractItemModel> *list, int index) 0044 { 0045 auto q = static_cast<KConcatenateRowsProxyModel *>(list->data); 0046 return q->sources().at(index); 0047 } 0048 0049 void KConcatenateRowsProxyModelQml::clear(QQmlListProperty<QAbstractItemModel> *list) 0050 { 0051 auto q = static_cast<KConcatenateRowsProxyModel *>(list->data); 0052 const auto sources = q->sources(); 0053 for (auto s : sources) { 0054 q->removeSourceModel(s); 0055 } 0056 } 0057 0058 #include "moc_kconcatenaterowsproxymodel_qml.cpp" 0059 0060 #endif