From 4a1003f2d4d40512f3f64e1b6d65f27edb6a62c0 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, 31 Mar 2023 11:29:05 +0800 Subject: Actions/MenuItems part is replaced by ListView Later Menu should be replaced by Popup, since the cart is not supposed to be a menu anyway. It's more of a popup. --- Header.ui.qml | 41 ++++++++++++++++++++--------------------- Header/CartItem.ui.qml | 3 ++- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Header.ui.qml b/Header.ui.qml index daa2af1..3262240 100644 --- a/Header.ui.qml +++ b/Header.ui.qml @@ -12,6 +12,7 @@ ToolBar { property alias logo: logo property alias cart: cart property alias cartMenu: cartMenu + property alias cartItems: cartItems property alias checkout: checkout property alias profile: profile property string profileImageSource: @@ -134,15 +135,6 @@ ToolBar { width: 256 sourceComponent: background } - delegate: MenuItem { - contentItem: CartItem { - imageSource: icon.source - titleText: text - } - background: Rectangle { - color: "transparent" - } - } Lbl.H5 { text: qsTr("Cart items") @@ -152,18 +144,25 @@ ToolBar { bottomPadding: 25.6 } - Action { - icon.source: - "https://eduport.webestica.com/assets/images/book/02.jpg" - text: - "Angular 4 Tutorial in audio (Compact Disk)" - } - - Action { - icon.source: - "https://eduport.webestica.com/assets/images/book/04.jpg" - text: - "The Principles of Beautiful Graphics Design (Paperback)" + ListView { + id: cartItems + interactive: false + implicitHeight: count * 120 + model: ListModel { + ListElement { + image: "https://eduport.webestica.com/assets/images/book/02.jpg" + title: "Angular 4 Tutorial in audio (Compact Disk)" + } + ListElement { + image: "https://eduport.webestica.com/assets/images/book/04.jpg" + title: "The Principles of Beautiful Graphics Design (Paperback)" + } + } + delegate: CartItem { + width: cartItems.width + imageSource: image + titleText: title + } } Loader { diff --git a/Header/CartItem.ui.qml b/Header/CartItem.ui.qml index 83600a5..210254a 100644 --- a/Header/CartItem.ui.qml +++ b/Header/CartItem.ui.qml @@ -22,7 +22,8 @@ ColumnLayout { } RowLayout { - Layout.margins: 16 + Layout.leftMargin: 16 + Layout.rightMargin: 16 Image { Layout.alignment: Qt.AlignTop -- cgit v1.2.3