From 30da849074d90ecd7baaf7705aee81149c732dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Tue, 30 Jun 2020 17:26:38 +0800 Subject: Getter setter for C struct data --- qicclient/basket.hxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'qicclient') diff --git a/qicclient/basket.hxx b/qicclient/basket.hxx index 8d697e6..af4d81c 100644 --- a/qicclient/basket.hxx +++ b/qicclient/basket.hxx @@ -38,24 +38,24 @@ namespace ICClient { Q_PROPERTY(double totalCost READ totalCost NOTIFY totalCostChanged) public: - explicit Basket(QObject* parent = nullptr) - : QAbstractListModel{parent} - , m_subtotal{.0} - , m_shipping{.0} - , m_totalCost{.0} + explicit Basket(QObject* parent = nullptr) : + QAbstractListModel{parent}, + m_subtotal{.0}, + m_shipping{.0}, + m_totalCost{.0} {} + int rowCount(QModelIndex const& parent + = QModelIndex()) const Q_DECL_OVERRIDE; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE; - int rowCount(QModelIndex const& parent - = QModelIndex()) const Q_DECL_OVERRIDE; + icclient_ord_order* data() { return m_data; } + void setData(icclient_ord_order* order); double subtotal() const { return m_subtotal; } double shipping() const { return m_shipping; } double totalCost() const { return m_totalCost; } - icclient_ord_order* c_order() { return order; } - void update(icclient_ord_order* order); signals: void rowCountChanged(); @@ -69,10 +69,10 @@ namespace ICClient { private: void addItem(Item const& item); QList items; + icclient_ord_order* m_data; double m_subtotal; double m_shipping; double m_totalCost; - icclient_ord_order* order; }; } -- cgit v1.2.3