-
Notifications
You must be signed in to change notification settings - Fork 364
/
CppTool.h
49 lines (43 loc) · 1000 Bytes
/
CppTool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include <QObject>
#include <QSharedData>
#include <QJsonValue>
#include <QJsonObject>
#include <QJsonArray>
#include <QImage>
#include <QPixmap>
#include <QPicture>
#include <QBitmap>
#include <QVector>
#include <QList>
#include <qqml.h>
struct CppData
{
Q_GADGET
Q_PROPERTY(qint64 id MEMBER id)
Q_PROPERTY(QString name MEMBER name)
public:
Q_INVOKABLE CppData();
CppData(const CppData &other);
~CppData();
CppData &operator =(const CppData &other);
Q_INVOKABLE QString toString();
qint64 id{0};
QString name;
QByteArray data;
};
Q_DECLARE_METATYPE(CppData)
class CppTool : public QObject
{
Q_OBJECT
Q_DISABLE_COPY_MOVE(CppTool)
private:
explicit CppTool(QObject *parent = nullptr);
public:
~CppTool();
static CppTool *getInstance();
Q_INVOKABLE CppData createData();
Q_INVOKABLE void setData(const CppData &data);
Q_INVOKABLE QVariant createMeta();
Q_INVOKABLE void setMeta(const QVariant &var);
};