Skip to content

Commit cb1f3d9

Browse files
committed
qml: Cleanup QML properties in FeeSelection
1 parent f4f9b79 commit cb1f3d9

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/qml/components/FeeSelection.qml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import QtQuick.Layouts 1.15
99
import "../controls"
1010
import "../components"
1111

12-
Item {
12+
RowLayout {
1313
id: root
1414

1515
property int selectedIndex: 1
@@ -22,16 +22,14 @@ Item {
2222

2323
CoreText {
2424
id: label
25-
anchors.left: parent.left
26-
anchors.verticalCenter: parent.verticalCenter
25+
Layout.fillWidth: true
26+
horizontalAlignment: Text.AlignLeft
2727
text: qsTr("Fee")
2828
font.pixelSize: 15
2929
}
3030

3131
Button {
3232
id: dropDownButton
33-
anchors.right: parent.right
34-
anchors.verticalCenter: parent.verticalCenter
3533
text: root.selectedLabel
3634
font.pixelSize: 15
3735

@@ -45,7 +43,6 @@ Item {
4543

4644
contentItem: RowLayout {
4745
spacing: 5
48-
anchors.centerIn: parent
4946

5047
CoreText {
5148
id: value
@@ -108,8 +105,8 @@ Item {
108105

109106
width: 260
110107
height: Math.min(feeModel.count * 40 + 20, 300)
111-
x: parent.width - width
112-
y: parent.height
108+
x: feePopup.parent.width - feePopup.width
109+
y: feePopup.parent.height
113110

114111
contentItem: ListView {
115112
id: feeList
@@ -118,6 +115,7 @@ Item {
118115
width: 260
119116
height: contentHeight
120117
delegate: ItemDelegate {
118+
id: delegate
121119
required property string feeLabel
122120
required property int index
123121
required property int target
@@ -133,20 +131,18 @@ Item {
133131
visible: mouseArea.containsMouse
134132
}
135133

136-
RowLayout {
137-
anchors.fill: parent
138-
anchors.margins: 12
134+
contentItem: RowLayout {
139135
spacing: 10
140136

141137
CoreText {
142138
text: feeLabel
139+
horizontalAlignment: Text.AlignLeft
140+
Layout.fillWidth: true
143141
font.pixelSize: 15
144142
}
145143

146-
Item { Layout.fillWidth: true }
147-
148144
Icon {
149-
visible: index === root.selectedIndex
145+
visible: delegate.index === root.selectedIndex
150146
source: "image://images/check"
151147
color: Theme.color.orange
152148
size: 20
@@ -159,7 +155,7 @@ Item {
159155
hoverEnabled: true
160156
cursorShape: Qt.PointingHandCursor
161157
onClicked: {
162-
root.selectedIndex = index
158+
root.selectedIndex = delegate.index
163159
root.selectedLabel = feeLabel
164160
root.feeChanged(target)
165161
feePopup.close()
@@ -172,7 +168,7 @@ Item {
172168
anchors.bottom: parent.bottom
173169
height: 1
174170
color: Theme.color.neutral3
175-
visible: index < feeModel.count - 1
171+
visible: delegate.index < feeModel.count - 1
176172
}
177173
}
178174
}

0 commit comments

Comments
 (0)