ViewSolutions 1.0.100.30ae2aa
View solutions of qml for quasarapp projects
Loading...
Searching...
No Matches
imodel.h
Go to the documentation of this file.
1//#
2//# Copyright (C) 2020-2025 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7
8#ifndef IMODEL_H
9#define IMODEL_H
10
11#include <QQmlApplicationEngine>
12#include <QString>
13#include <QWeakPointer>
15
16
17namespace ViewSolutions {
18
19class ModelStorage;
20
51{
52public:
53 iModel() = default;
54 virtual ~iModel() = default;
55
60 virtual QString modelId() const = 0;
61
66 const QWeakPointer<ModelStorage>& storage() const;
67
76 QQmlEngine * engine() const;
77
78protected:
79
84 virtual void initStorage(const QWeakPointer<ModelStorage>& newStorage);
85
86private:
87
88 QWeakPointer<ModelStorage> m_storage;
89
90 friend class ModelStorage;
91};
92
93}
94#endif // IMODEL_H
The ModelStorage class is the main model storage object.
virtual QString modelId() const =0
modelId returns text model id. override this method to provide access to model in qml or other models...
virtual ~iModel()=default
QQmlEngine * engine() const
engine returns qml engine.
Definition imodel.cpp:19
friend class ModelStorage
Definition imodel.h:90
virtual void initStorage(const QWeakPointer< ModelStorage > &newStorage)
initStorage This method is called by storage object after adding model to storage.
Definition imodel.cpp:27
const QWeakPointer< ModelStorage > & storage() const
storage returns storage object. this method return context of the model's storage.
Definition imodel.cpp:15
The ViewSolutions namespace.
#define VIEWSOLUTION_EXPORT
VIEWSOLUTION_EXPORT marks a symbol as part of the public ViewSolutions API.