Skip to content

Commit 7c8a68c

Browse files
committed
qml: Fix layout in activity view
1 parent 63e8494 commit 7c8a68c

File tree

1 file changed

+111
-121
lines changed

1 file changed

+111
-121
lines changed

src/qml/pages/wallet/Activity.qml

Lines changed: 111 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -20,146 +20,136 @@ PageStack {
2020
}
2121
}
2222

23-
initialItem: Page {
24-
id: root
25-
background: null
23+
initialItem: RowLayout {
24+
Page {
25+
Layout.alignment: Qt.AlignCenter
26+
Layout.fillHeight: true
27+
Layout.fillWidth: true
28+
Layout.maximumWidth: 600
29+
Layout.margins: 20
30+
id: root
31+
background: null
2632

27-
CoreText {
28-
id: title
29-
text: qsTr("Activity")
30-
anchors.left: listView.left
31-
anchors.top: parent.top
32-
anchors.topMargin: 20
33-
font.pixelSize: 21
34-
bold: true
35-
}
33+
header: CoreText {
34+
id: title
35+
horizontalAlignment: Text.AlignLeft
36+
text: qsTr("Activity")
37+
font.pixelSize: 21
38+
bold: true
39+
}
3640

37-
ListView {
38-
id: listView
39-
clip: true
40-
width: Math.min(parent.width - 40, 600)
41-
anchors.horizontalCenter: parent.horizontalCenter
42-
anchors.top: title.bottom
43-
anchors.bottom: parent.bottom
41+
contentItem: ListView {
42+
id: listView
43+
clip: true
44+
model: walletController.selectedWallet.activityListModel
45+
delegate: ItemDelegate {
46+
id: delegate
47+
required property string address;
48+
required property string amount;
49+
required property string date;
50+
required property int depth;
51+
required property string label;
52+
required property int status;
53+
required property int type;
4454

45-
model: walletController.selectedWallet.activityListModel
46-
delegate: ItemDelegate {
47-
id: delegate
48-
required property string address;
49-
required property string amount;
50-
required property string date;
51-
required property int depth;
52-
required property string label;
53-
required property int status;
54-
required property int type;
55+
HoverHandler {
56+
cursorShape: Qt.PointingHandCursor
57+
}
5558

56-
width: listView.width
57-
height: 51
59+
onClicked: stackView.push(detailsPage)
5860

59-
background: Item {
60-
Separator {
61-
anchors.bottom: parent.bottom
62-
width: parent.width
61+
width: ListView.view.width
62+
63+
background: Item {
64+
Separator {
65+
anchors.bottom: parent.bottom
66+
width: parent.width
67+
}
6368
}
64-
}
6569

66-
contentItem: Item {
67-
Icon {
68-
id: directionIcon
69-
anchors.left: parent.left
70-
anchors.margins: 6
71-
anchors.verticalCenter: parent.verticalCenter
72-
source: {
73-
if (delegate.type == Transaction.RecvWithAddress
74-
|| delegate.type == Transaction.RecvFromOther) {
75-
"qrc:/icons/triangle-down"
76-
} else if (delegate.type == Transaction.Generated) {
77-
"qrc:/icons/coinbase"
78-
} else {
79-
"qrc:/icons/triangle-up"
70+
contentItem: RowLayout {
71+
Icon {
72+
Layout.alignment: Qt.AlignCenter
73+
Layout.margins: 6
74+
source: {
75+
if (delegate.type == Transaction.RecvWithAddress
76+
|| delegate.type == Transaction.RecvFromOther) {
77+
"qrc:/icons/triangle-down"
78+
} else if (delegate.type == Transaction.Generated) {
79+
"qrc:/icons/coinbase"
80+
} else {
81+
"qrc:/icons/triangle-up"
82+
}
8083
}
81-
}
82-
color: {
83-
if (delegate.status == Transaction.Confirmed) {
84-
if (delegate.type == Transaction.RecvWithAddress ||
85-
delegate.type == Transaction.RecvFromOther ||
86-
delegate.type == Transaction.Generated) {
87-
Theme.color.green
84+
color: {
85+
if (delegate.status == Transaction.Confirmed) {
86+
if (delegate.type == Transaction.RecvWithAddress ||
87+
delegate.type == Transaction.RecvFromOther ||
88+
delegate.type == Transaction.Generated) {
89+
Theme.color.green
90+
} else {
91+
Theme.color.orange
92+
}
8893
} else {
89-
Theme.color.orange
94+
Theme.color.blue
9095
}
91-
} else {
92-
Theme.color.blue
9396
}
97+
size: 14
9498
}
95-
size: 14
96-
}
97-
CoreText {
98-
id: label
99-
anchors.left: directionIcon.right
100-
anchors.right: date.left
101-
anchors.margins: 6
102-
anchors.verticalCenter: parent.verticalCenter
103-
elide: Text.ElideMiddle
104-
text: {
105-
if (delegate.label != "") {
106-
delegate.label
107-
} else {
108-
delegate.address
99+
CoreText {
100+
Layout.alignment: Qt.AlignCenter
101+
Layout.fillWidth: true
102+
Layout.preferredWidth: 0
103+
Layout.margins: 6
104+
color: delegate.hovered ? Theme.color.orange : Theme.color.neutral9
105+
elide: Text.ElideMiddle
106+
text: {
107+
if (delegate.label != "") {
108+
delegate.label
109+
} else {
110+
delegate.address
111+
}
109112
}
113+
font.pixelSize: 15
114+
horizontalAlignment: Text.AlignLeft
115+
clip: true
110116
}
111-
font.pixelSize: 15
112-
horizontalAlignment: Text.AlignLeft
113-
clip: true
114-
}
115117

116-
CoreText {
117-
id: date
118-
anchors.right: amount.left
119-
anchors.margins: 6
120-
anchors.verticalCenter: parent.verticalCenter
121-
text: delegate.date
122-
font.pixelSize: 15
123-
horizontalAlignment: Text.AlignRight
124-
}
118+
CoreText {
119+
Layout.alignment: Qt.AlignCenter
120+
Layout.margins: 6
121+
text: delegate.date
122+
font.pixelSize: 15
123+
horizontalAlignment: Text.AlignRight
124+
}
125125

126-
CoreText {
127-
id: amount
128-
anchors.right: parent.right
129-
anchors.margins: 6
130-
anchors.verticalCenter: parent.verticalCenter
131-
text: delegate.amount
132-
font.pixelSize: 15
133-
horizontalAlignment: Text.AlignRight
134-
color: {
135-
if (delegate.type == Transaction.RecvWithAddress
136-
|| delegate.type == Transaction.RecvFromOther
137-
|| delegate.type == Transaction.Generated) {
138-
Theme.color.green
139-
} else {
140-
Theme.color.neutral9
126+
CoreText {
127+
Layout.alignment: Qt.AlignCenter
128+
Layout.margins: 6
129+
text: delegate.amount
130+
font.pixelSize: 15
131+
horizontalAlignment: Text.AlignRight
132+
color: {
133+
if (delegate.type == Transaction.RecvWithAddress
134+
|| delegate.type == Transaction.RecvFromOther
135+
|| delegate.type == Transaction.Generated) {
136+
Theme.color.green
137+
} else {
138+
Theme.color.neutral9
139+
}
141140
}
142141
}
143-
}
144-
145-
MouseArea {
146-
anchors.fill: parent
147-
onClicked: stackView.push(detailsPage)
148-
hoverEnabled: true
149-
onEntered: label.color = Theme.color.orange
150-
onExited: label.color = Theme.color.neutral9
151-
cursorShape: Qt.PointingHandCursor
152-
}
153142

154-
Component {
155-
id: detailsPage
156-
ActivityDetails {
157-
amount: delegate.amount
158-
date: delegate.date
159-
depth: delegate.depth
160-
type: delegate.type
161-
status: delegate.status
162-
address: delegate.address
143+
Component {
144+
id: detailsPage
145+
ActivityDetails {
146+
amount: delegate.amount
147+
date: delegate.date
148+
depth: delegate.depth
149+
type: delegate.type
150+
status: delegate.status
151+
address: delegate.address
152+
}
163153
}
164154
}
165155
}

0 commit comments

Comments
 (0)