Skip to content

Commit 2f08efc

Browse files
committed
Merge #370: Add interactive color states to peers table
e8a2bbc qml: add interactive color states to peers table (jarolrod) Pull request description: Introduces color states for hover and and pressed to the peers in the peers table. ### Light | Filled | Hover | Pressed | |--------|-------|---------| | <img width="486" alt="Screenshot 2023-11-09 at 7 10 37 PM" src="https://github.com/bitcoin-core/gui-qml/assets/23396902/377122f2-b366-4fb6-b9f2-000aaab8d91b"> | <img width="486" alt="Screenshot 2023-11-09 at 7 10 11 PM" src="https://github.com/bitcoin-core/gui-qml/assets/23396902/4fb66b56-e30d-487f-8f7e-b1937d6002d1"> | <img width="486" alt="Screenshot 2023-11-09 at 7 10 20 PM" src="https://github.com/bitcoin-core/gui-qml/assets/23396902/638d3bfe-d52b-4841-89d3-01229783459c"> | ### Dark | Filled | Hover | Pressed | |--------|-------|---------| | <img width="486" alt="Screenshot 2023-11-09 at 7 03 23 PM" src="https://github.com/bitcoin-core/gui-qml/assets/23396902/948c034e-d2c8-42b0-938d-8eda329e03c2"> | <img width="486" alt="Screenshot 2023-11-09 at 7 03 18 PM" src="https://github.com/bitcoin-core/gui-qml/assets/23396902/942bb1a7-05f5-416c-90e8-1701a25ef254"> | <img width="486" alt="Screenshot 2023-11-09 at 7 03 40 PM" src="https://github.com/bitcoin-core/gui-qml/assets/23396902/9f27e928-513c-4c3e-a29e-8325d002db8c"> | [![Build Artifacts](https://img.shields.io/badge/Build%20Artifacts-green )](https://github.com/bitcoin-core/gui-qml/actions/runs/6819492294) ACKs for top commit: pablomartin4btc: utACK e8a2bbc Tree-SHA512: 20dff534c5e22803c7a5606d33b68e12d5a90f7fa55c0121263a22085e654b66865378fcebcb8b3f9006612bd759ba2344f5940673b1b47c67f67daf69e2eeaa
2 parents c77a96d + e8a2bbc commit 2f08efc

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

src/qml/pages/node/Peers.qml

+42-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import QtQuick 2.15
66
import QtQuick.Controls 2.15
77
import QtQuick.Layouts 1.15
8+
import org.bitcoincore.qt 1.0
89
import "../../controls"
910
import "../../components"
1011

@@ -132,14 +133,53 @@ Page {
132133
}
133134

134135
delegate: Item {
136+
id: delegate
135137
required property int nodeId;
136138
required property string address;
137139
required property string subversion;
138140
required property string direction;
139141
required property string connectionType;
140142
required property string network;
143+
property color stateColor;
141144
implicitHeight: 60
142145
implicitWidth: listView.width
146+
state: "FILLED"
147+
148+
states: [
149+
State {
150+
name: "FILLED"
151+
PropertyChanges { target: delegate; stateColor: Theme.color.neutral9 }
152+
},
153+
State {
154+
name: "HOVER"
155+
PropertyChanges { target: delegate; stateColor: Theme.color.orangeLight1 }
156+
},
157+
State {
158+
name: "ACTIVE"
159+
PropertyChanges { target: delegate; stateColor: Theme.color.orange }
160+
}
161+
]
162+
163+
MouseArea {
164+
anchors.fill: parent
165+
hoverEnabled: AppMode.isDesktop
166+
onEntered: {
167+
delegate.state = "HOVER"
168+
}
169+
onExited: {
170+
delegate.state = "FILLED"
171+
}
172+
onPressed: {
173+
delegate.state = "ACTIVE"
174+
}
175+
onReleased: {
176+
if (mouseArea.containsMouse) {
177+
delegate.state = "HOVER"
178+
} else {
179+
delegate.state = "FILLED"
180+
}
181+
}
182+
}
143183

144184
Connections {
145185
target: peerListModelProxy
@@ -200,7 +240,7 @@ Page {
200240
Layout.alignment: Qt.AlignLeft
201241
id: primary
202242
font.pixelSize: 18
203-
color: Theme.color.neutral9
243+
color: delegate.stateColor
204244
}
205245
CoreText {
206246
Layout.alignment: Qt.AlignLeft
@@ -215,7 +255,7 @@ Page {
215255
Layout.alignment: Qt.AlignRight
216256
id: secondary
217257
font.pixelSize: 18
218-
color: Theme.color.neutral9
258+
color: delegate.stateColor
219259
}
220260
CoreText {
221261
Layout.alignment: Qt.AlignRight

0 commit comments

Comments
 (0)