-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathd_asset.h
45 lines (32 loc) · 1.14 KB
/
d_asset.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
#pragma once
#include <QObject>
#include <QVariantMap>
class D_Asset : public QObject
{
Q_OBJECT
Q_PROPERTY(int acc_idx READ acc_idx WRITE setAcc_idx NOTIFY acc_idxChanged FINAL)
Q_PROPERTY(QString asset READ asset WRITE setAsset NOTIFY assetChanged FINAL)
Q_PROPERTY(double amount READ amount WRITE setAmount NOTIFY amountChanged FINAL)
Q_PROPERTY(double price READ price WRITE setPrice NOTIFY priceChanged FINAL)
public:
explicit D_Asset(int acc_idx, const QString& asset, double amount, double price, QObject *parent = nullptr);
int _acc_idx = 0;
QString _asset;
double _amount = 0.00;
double _price = 0.00;
int acc_idx() const { return _acc_idx; }
QString asset() const { return _asset; }
double amount() const { return _amount; }
double price() const { return _price; }
void setAcc_idx(int acc_idx);
void setAsset(const QString& asset);
void setAmount(double amount);
void setPrice(double price);
QVariantMap getMap();
void fromMap(QVariantMap map);
signals:
void acc_idxChanged();
void assetChanged();
void amountChanged();
void priceChanged();
};