Skip to content

Commit 12aa84c

Browse files
committed
qml: Put CoinSelection ListView in a ScrollView
1 parent 0012219 commit 12aa84c

File tree

1 file changed

+76
-68
lines changed

1 file changed

+76
-68
lines changed

src/qml/pages/wallet/CoinSelection.qml

Lines changed: 76 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ Page {
3636

3737
ColumnLayout {
3838
id: header
39-
width: Math.min(parent.width - 40, 450)
39+
anchors.top: parent.top
4040
anchors.horizontalCenter: parent.horizontalCenter
41+
width: Math.min(parent.width - 40, 450)
4142

4243
RowLayout {
4344
Layout.fillWidth: true
@@ -86,81 +87,88 @@ Page {
8687
}
8788
}
8889

89-
ListView {
90-
id: listView
91-
clip: true
92-
width: Math.min(parent.width - 40, 450)
90+
ScrollView {
91+
id: scrollView
92+
width: Math.min(parent.width - 40, 460)
9393
height: parent.height - header.height - 20
9494
anchors.top: header.bottom
95-
anchors.horizontalCenter: parent.horizontalCenter
96-
model: root.wallet.coinsListModel
97-
spacing: 15
98-
99-
delegate: ItemDelegate {
100-
id: delegate
101-
required property string address;
102-
required property string amount;
103-
required property string label;
104-
required property bool locked;
105-
required property bool selected;
106-
107-
required property int index;
108-
109-
readonly property color stateColor: {
110-
if (delegate.down) {
111-
return Theme.color.orange
112-
} else if (delegate.hovered) {
113-
return Theme.color.orangeLight1
114-
}
115-
return Theme.color.neutral9
116-
}
95+
anchors.left: header.left
96+
clip: true
11797

118-
leftPadding: 0
119-
rightPadding: 0
120-
topPadding: 0
121-
bottomPadding: 14
122-
width: listView.width
98+
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
12399

124-
background: Item {
125-
Separator {
126-
anchors.bottom: parent.bottom
127-
width: parent.width
128-
}
129-
}
100+
ListView {
101+
id: listView
102+
width: parent.width
103+
model: root.wallet.coinsListModel
104+
spacing: 15
130105

131-
contentItem: RowLayout {
132-
width: parent.width
133-
CoreCheckBox {
134-
id: checkBox
135-
Layout.minimumWidth: 20
136-
enabled: !locked
137-
checked: selected
138-
visible: !locked
139-
MouseArea {
140-
anchors.fill: parent
141-
enabled: false
142-
hoverEnabled: true
143-
cursorShape: Qt.PointingHandCursor
106+
delegate: ItemDelegate {
107+
id: delegate
108+
required property string address;
109+
required property string amount;
110+
required property string label;
111+
required property bool locked;
112+
required property bool selected;
113+
114+
required property int index;
115+
116+
readonly property color stateColor: {
117+
if (delegate.down) {
118+
return Theme.color.orange
119+
} else if (delegate.hovered) {
120+
return Theme.color.orangeLight1
144121
}
145-
146-
onToggled: listView.model.toggleCoinSelection(index)
147-
}
148-
Icon {
149-
source: "qrc:/icons/lock"
150-
color: Theme.color.neutral9
151-
visible: locked
152-
size: 20
122+
return Theme.color.neutral9
153123
}
154-
CoreText {
155-
text: amount
156-
font.pixelSize: 18
124+
125+
leftPadding: 0
126+
rightPadding: 10
127+
topPadding: 0
128+
bottomPadding: 14
129+
width: listView.width
130+
131+
background: Item {
132+
Separator {
133+
anchors.bottom: parent.bottom
134+
width: parent.width - 10
135+
}
157136
}
158-
CoreText {
159-
Layout.fillWidth: true
160-
text: label != "" ? label : address
161-
font.pixelSize: 18
162-
elide: Text.ElideMiddle
163-
wrapMode: Text.NoWrap
137+
138+
contentItem: RowLayout {
139+
width: parent.width
140+
CoreCheckBox {
141+
id: checkBox
142+
Layout.minimumWidth: 20
143+
enabled: !locked
144+
checked: selected
145+
visible: !locked
146+
MouseArea {
147+
anchors.fill: parent
148+
enabled: false
149+
hoverEnabled: true
150+
cursorShape: Qt.PointingHandCursor
151+
}
152+
153+
onToggled: listView.model.toggleCoinSelection(index)
154+
}
155+
Icon {
156+
source: "qrc:/icons/lock"
157+
color: Theme.color.neutral9
158+
visible: locked
159+
size: 20
160+
}
161+
CoreText {
162+
text: amount
163+
font.pixelSize: 18
164+
}
165+
CoreText {
166+
Layout.fillWidth: true
167+
text: label != "" ? label : address
168+
font.pixelSize: 18
169+
elide: Text.ElideMiddle
170+
wrapMode: Text.NoWrap
171+
}
164172
}
165173
}
166174
}

0 commit comments

Comments
 (0)