diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-12 18:57:01 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-12 18:57:01 +0800 |
commit | c8ed6cbb4a3a9051fcc2536fd6e751da7a3264cf (patch) | |
tree | a5beba996759bf4cced505efd0333fa52456f407 /interchange | |
parent | f70a1a57d83e4f50a7221d13b173a156ef0eb6cf (diff) |
Item & Ord are with constructed with copies, not pointers
Diffstat (limited to 'interchange')
-rw-r--r-- | interchange/ord.hxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/interchange/ord.hxx b/interchange/ord.hxx index 56bb7d3..4ec06b4 100644 --- a/interchange/ord.hxx +++ b/interchange/ord.hxx @@ -13,9 +13,9 @@ namespace QInterchange { enum ItemRoles { QuantityRole = Product::PriceRole + 1 }; - Item(interchange_ord_item* item) : - product{item->product}, - quantity{item->quantity} {} + Item(interchange_ord_item item) : + product{item.product}, + quantity{item.quantity} {} Product product; unsigned int quantity; bool operator==(Item const& item) @@ -33,13 +33,12 @@ namespace QInterchange { Q_PROPERTY(double totalCost READ totalCost NOTIFY totalCostChanged) public: - explicit Ord(struct interchange_ord_order* order - = nullptr, QObject* parent = nullptr); - ~Ord(); + explicit Ord(struct interchange_ord_order order, + QObject* parent = nullptr); + ~Ord() {} int rowCount(QModelIndex const& parent = QModelIndex()) const Q_DECL_OVERRIDE; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - struct interchange_ord_order* data() { return m_data; } double subtotal() const { return m_subtotal; } double shipping() const { return m_shipping; } double totalCost() const { return m_totalCost; } @@ -61,7 +60,6 @@ namespace QInterchange { private: void addItem(Item const& item); QList<Item> items; - struct interchange_ord_order* m_data; QString profile; double m_subtotal; double m_shipping; |