6#include <QtCore/QObject>
7#include <QtCore/QVariant>
14class CItemModelBase :
public QObject
18 explicit CItemModelBase(QObject* parent =
nullptr);
20 Q_INVOKABLE
virtual void beginChanges();
21 Q_INVOKABLE
virtual void endChanges();
22 Q_INVOKABLE
virtual QString toJson()
const;
23 Q_INVOKABLE
virtual bool createFromJson(
const QString& json);
24 Q_INVOKABLE
virtual bool fromObject(
const QJsonObject& jsonObject);
25 Q_INVOKABLE
virtual QString toGraphQL()
const;
26 Q_INVOKABLE
virtual bool isEqualWithModel(CItemModelBase* other)
const;
27 Q_INVOKABLE
virtual CItemModelBase* copyMe();
28 Q_INVOKABLE
virtual bool copyFrom(CItemModelBase* other);
29 Q_INVOKABLE
virtual bool copyTo(CItemModelBase* other);
30 Q_INVOKABLE
virtual QVariant CreateObject(
const QString& key);
31 Q_INVOKABLE
virtual QStringList getProperties()
const;
32 Q_INVOKABLE
virtual QString getJSONKeyForProperty(
const QString& propertyName)
const;
35 void modelChanged(
const QVariantList& changes);
39 void OnInternalModelChanged();
40 void OnModelChanged(
const QVariantList& changes);
43 virtual CItemModelBase* CreateItemModel(
const QString& jsonKey);
46 bool m_enableNotifications =
true;
47 CItemModelBase* m_owner;
48 bool m_isTransaction =
false;
49 int m_changeCount = 0;
50 QVariantList m_changeList;
52 void emitChange(
const QString& name);