From f1503bf1a34cdb7b66171a2772108e7475ea792a 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: Sun, 19 Feb 2023 15:48:18 +0800 Subject: Add product title --- catalog.cxx | 3 +++ interchange/product.hxx | 4 ++++ ord.cxx | 3 +++ 3 files changed, 10 insertions(+) diff --git a/catalog.cxx b/catalog.cxx index b971525..395412c 100644 --- a/catalog.cxx +++ b/catalog.cxx @@ -29,6 +29,8 @@ namespace QInterchange { switch (role) { case Product::SkuRole: return product.sku; + case Product::TitleRole: + return product.title; case Product::DescriptionRole: return product.description; case Product::CommentRole: @@ -56,6 +58,7 @@ namespace QInterchange { { return QHash{ { Product::SkuRole, "sku" }, + { Product::TitleRole, "title" }, { Product::DescriptionRole, "description" }, { Product::CommentRole, "comment" }, { Product::ThumbRole, "thumb" }, diff --git a/interchange/product.hxx b/interchange/product.hxx index 483ee42..63ac63e 100644 --- a/interchange/product.hxx +++ b/interchange/product.hxx @@ -9,6 +9,7 @@ namespace QInterchange { { enum ProductRoles { SkuRole = Qt::UserRole + 1, + TitleRole, DescriptionRole, CommentRole, ThumbRole, @@ -27,6 +28,8 @@ namespace QInterchange { { if (product->sku) sku = QString{product->sku}; + if (product->title) + title = QString{product->title}; if (product->description) description = QString{product->description}; if (product->comment) @@ -47,6 +50,7 @@ namespace QInterchange { } QString sku; + QString title; QString description; QString comment; QString thumb; diff --git a/ord.cxx b/ord.cxx index 0d8f6eb..a80043e 100644 --- a/ord.cxx +++ b/ord.cxx @@ -36,6 +36,8 @@ namespace QInterchange { switch (role) { case Product::SkuRole: return item.product.sku; + case Product::TitleRole: + return item.product.title; case Product::DescriptionRole: return item.product.description; case Product::ImageRole: @@ -53,6 +55,7 @@ namespace QInterchange { { return QHash{ { Product::SkuRole, "sku" }, + { Product::TitleRole, "title" }, { Product::DescriptionRole, "description" }, { Product::ImageRole, "image" }, { Product::PriceRole, "price" }, -- cgit v1.2.3