From 4c43c27774cfc3652ff3269519ee248e71b58185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Fri, 16 Jun 2023 15:40:24 +0800 Subject: Item is now a subclass of Product --- interchange/ord.hxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'interchange/ord.hxx') diff --git a/interchange/ord.hxx b/interchange/ord.hxx index 34ff202..a7e41a7 100644 --- a/interchange/ord.hxx +++ b/interchange/ord.hxx @@ -8,22 +8,23 @@ namespace QInterchange { - struct Item + struct Item : public Product { enum ItemRoles { QuantityRole = Product::PriceRole + 1, NameRole }; - Item(interchange_ord_item item) : - product{&item.product}, - quantity{item.quantity}, - name{item.name} {} - Product product; + Item(interchange_ord_item *item) : + quantity{item->quantity}, + name{item->name} + { + init((struct interchange_product *)item); + } unsigned int quantity; QString name; bool operator==(Item const& item) { - return product.sku == item.product.sku; + return sku == item.sku; } }; -- cgit v1.2.3