diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-31 14:19:05 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-31 14:19:05 +0800 |
commit | 7f4aca0bba24d4616ed78c288bc89b12ac6a3c84 (patch) | |
tree | 5b90886fb44574fd174f847507965b944a1a78fb | |
parent | dc6d4edab4584a7153edcde86ae61fb9100e780a (diff) |
Add name to Item
-rw-r--r-- | interchange/ord.hxx | 7 | ||||
-rw-r--r-- | ord.cxx | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/interchange/ord.hxx b/interchange/ord.hxx index 985f923..7405c55 100644 --- a/interchange/ord.hxx +++ b/interchange/ord.hxx @@ -11,13 +11,16 @@ namespace QInterchange { struct Item { enum ItemRoles { - QuantityRole = Product::PriceRole + 1 + QuantityRole = Product::PriceRole + 1, + NameRole }; Item(interchange_ord_item item) : product{item.product}, - quantity{item.quantity} {} + quantity{item.quantity}, + name{item.name} {} Product product; unsigned int quantity; + QString name; bool operator==(Item const& item) { return product.sku == item.product.sku; @@ -47,6 +47,8 @@ namespace QInterchange { return item.product.price; case Item::QuantityRole: return item.quantity; + case Item::NameRole: + return item.name; default: return QVariant(); } @@ -60,7 +62,8 @@ namespace QInterchange { { Product::DescriptionRole, "description" }, { Product::ImageRole, "image" }, { Product::PriceRole, "price" }, - { Item::QuantityRole, "quantity" } + { Item::QuantityRole, "quantity" }, + { Item::NameRole, "name" } }; } |