Warning, file /network/ruqola/src/core/model/custombasemodel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "libruqolacore_export.h" 0010 #include <QAbstractListModel> 0011 class LIBRUQOLACORE_EXPORT CustomBaseModel : public QAbstractListModel 0012 { 0013 Q_OBJECT 0014 public: 0015 explicit CustomBaseModel(QObject *parent = nullptr); 0016 ~CustomBaseModel() override; 0017 0018 [[nodiscard]] virtual int total() const = 0; 0019 0020 void setHasFullList(bool state); 0021 [[nodiscard]] bool hasFullList() const; 0022 0023 [[nodiscard]] bool loadMoreInProgress() const; 0024 void setLoadMoreInProgress(bool loadMoreInProgress); 0025 0026 virtual void parseElements(const QJsonObject &obj) = 0; 0027 0028 virtual void addMoreElements(const QJsonObject &obj) = 0; 0029 0030 virtual QList<int> hideColumns() const = 0; 0031 0032 virtual QList<int> excludeResizeToContentColumns() const; 0033 0034 virtual void insertElement(const QJsonObject &obj); 0035 0036 virtual void removeElement(const QString &identifier); 0037 0038 virtual void updateElement(const QJsonObject &obj); 0039 0040 void initialize(); 0041 0042 protected: 0043 virtual void checkFullList() = 0; 0044 Q_SIGNALS: 0045 void hasFullListChanged(); 0046 void totalChanged(); 0047 void loadingInProgressChanged(); 0048 0049 private: 0050 bool mLoadMoreInProgress = false; 0051 bool mHasFullList = false; 0052 };