@@ -9,7 +9,7 @@ import QtQuick.Layouts 1.15
9
9
import "../controls"
10
10
import "../components"
11
11
12
- Item {
12
+ RowLayout {
13
13
id: root
14
14
15
15
property int selectedIndex: 1
@@ -22,16 +22,14 @@ Item {
22
22
23
23
CoreText {
24
24
id: label
25
- anchors . left : parent . left
26
- anchors . verticalCenter : parent . verticalCenter
25
+ Layout . fillWidth : true
26
+ horizontalAlignment : Text . AlignLeft
27
27
text: qsTr (" Fee" )
28
28
font .pixelSize : 15
29
29
}
30
30
31
31
Button {
32
32
id: dropDownButton
33
- anchors .right : parent .right
34
- anchors .verticalCenter : parent .verticalCenter
35
33
text: root .selectedLabel
36
34
font .pixelSize : 15
37
35
45
43
46
44
contentItem: RowLayout {
47
45
spacing: 5
48
- anchors .centerIn : parent
49
46
50
47
CoreText {
51
48
id: value
@@ -108,8 +105,8 @@ Item {
108
105
109
106
width: 260
110
107
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
113
110
114
111
contentItem: ListView {
115
112
id: feeList
@@ -118,6 +115,7 @@ Item {
118
115
width: 260
119
116
height: contentHeight
120
117
delegate: ItemDelegate {
118
+ id: delegate
121
119
required property string feeLabel
122
120
required property int index
123
121
required property int target
@@ -133,20 +131,18 @@ Item {
133
131
visible: mouseArea .containsMouse
134
132
}
135
133
136
- RowLayout {
137
- anchors .fill : parent
138
- anchors .margins : 12
134
+ contentItem: RowLayout {
139
135
spacing: 10
140
136
141
137
CoreText {
142
138
text: feeLabel
139
+ horizontalAlignment: Text .AlignLeft
140
+ Layout .fillWidth : true
143
141
font .pixelSize : 15
144
142
}
145
143
146
- Item { Layout .fillWidth : true }
147
-
148
144
Icon {
149
- visible: index === root .selectedIndex
145
+ visible: delegate . index === root .selectedIndex
150
146
source: " image://images/check"
151
147
color: Theme .color .orange
152
148
size: 20
@@ -159,7 +155,7 @@ Item {
159
155
hoverEnabled: true
160
156
cursorShape: Qt .PointingHandCursor
161
157
onClicked: {
162
- root .selectedIndex = index
158
+ root .selectedIndex = delegate . index
163
159
root .selectedLabel = feeLabel
164
160
root .feeChanged (target)
165
161
feePopup .close ()
@@ -172,7 +168,7 @@ Item {
172
168
anchors .bottom : parent .bottom
173
169
height: 1
174
170
color: Theme .color .neutral3
175
- visible: index < feeModel .count - 1
171
+ visible: delegate . index < feeModel .count - 1
176
172
}
177
173
}
178
174
}
0 commit comments