diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-23 07:27:09 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-23 07:27:09 +0800 |
commit | 2924e9a4e7a5c371e7096daeb5b1d3a2b1860d46 (patch) | |
tree | 3fa2372bbdebcff43c7a72907e6f874f318f4186 /qicclient/ord.hxx | |
parent | 92d6ea68951e6f89c8689371f8abd84db1c57a9f (diff) |
Tidy up a bit
Diffstat (limited to 'qicclient/ord.hxx')
-rw-r--r-- | qicclient/ord.hxx | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/qicclient/ord.hxx b/qicclient/ord.hxx index 697daa7..5ece6de 100644 --- a/qicclient/ord.hxx +++ b/qicclient/ord.hxx @@ -13,15 +13,11 @@ namespace QICClient { enum ItemRoles { QuantityRole = Product::PriceRole + 1 }; - - Item(icclient_ord_item* item) - : product{item->product} - , quantity{item->quantity} - {} - + Item(icclient_ord_item* item) : + product{item->product}, + quantity{item->quantity} {} Product product; unsigned int quantity; - bool operator==(Item const& item) { return product.sku == item.product.sku; @@ -42,34 +38,25 @@ namespace QICClient { m_data{nullptr}, 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; - + 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; struct icclient_ord_order* data() { return m_data; } void setData(struct icclient_ord_order* order); double subtotal() const { return m_subtotal; } double shipping() const { return m_shipping; } double totalCost() const { return m_totalCost; } - public slots: // void remove(unsigned int const& indices); void checkout(Member& member); - signals: void rowCountChanged(); void subtotalChanged(); void shippingChanged(); void totalCostChanged(); - protected: QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; - private: void addItem(Item const& item); QList<Item> items; @@ -81,4 +68,4 @@ namespace QICClient { } -#endif // QICCLIENT_ORD_HXX +#endif |