Skip to content

Commit c9ef4b1

Browse files
committed
qml: add Hover,Filled, Active color interaction states to ExternalLink
This commits to the current state of the Setting control itself
1 parent aa98f35 commit c9ef4b1

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

src/qml/components/AboutOptions.qml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,47 @@ import "../controls"
1010
ColumnLayout {
1111
spacing: 20
1212
Setting {
13+
id: websiteLink
1314
Layout.fillWidth: true
1415
header: qsTr("Website")
1516
actionItem: ExternalLink {
17+
parentState: websiteLink.state
1618
description: "bitcoincore.org"
1719
link: "https://bitcoincore.org"
1820
iconSource: "image://images/caret-right"
1921
}
2022
onClicked: loadedItem.clicked()
2123
}
2224
Setting {
25+
id: sourceLink
2326
Layout.fillWidth: true
2427
header: qsTr("Source code")
2528
actionItem: ExternalLink {
29+
parentState: sourceLink.state
2630
description: "github.com/bitcoin/bitcoin"
2731
link: "https://github.com/bitcoin/bitcoin"
2832
iconSource: "image://images/caret-right"
2933
}
3034
onClicked: loadedItem.clicked()
3135
}
3236
Setting {
37+
id: licenseLink
3338
Layout.fillWidth: true
3439
header: qsTr("License")
3540
actionItem: ExternalLink {
41+
parentState: licenseLink.state
3642
description: "MIT"
3743
link: "https://opensource.org/licenses/MIT"
3844
iconSource: "image://images/caret-right"
3945
}
4046
onClicked: loadedItem.clicked()
4147
}
4248
Setting {
49+
id: versionLink
4350
Layout.fillWidth: true
4451
header: qsTr("Version")
4552
actionItem: ExternalLink {
53+
parentState: versionLink.state
4654
description: "v22.99.0-1e7564eca8a6"
4755
link: "https://bitcoin.org/en/download"
4856
iconSource: "image://images/caret-right"

src/qml/components/DeveloperOptions.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ import "../controls"
1010
ColumnLayout {
1111
spacing: 20
1212
Setting {
13+
id: devDocsLink
1314
Layout.fillWidth: true
1415
header: qsTr("Developer documentation")
1516
actionItem: ExternalLink {
17+
parentState: devDocsLink.state
1618
iconSource: "qrc:/icons/export"
1719
iconWidth: 30
1820
iconHeight: 30

src/qml/controls/ExternalLink.qml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,43 @@ import QtQuick.Layouts 1.15
88

99
AbstractButton {
1010
id: root
11+
required property string parentState
1112
required property string link
1213
property string description: ""
1314
property int descriptionSize: 18
1415
property url iconSource: ""
1516
property int iconWidth: 18
1617
property int iconHeight: 18
18+
property color iconColor
19+
property color textColor
20+
state: root.parentState
21+
22+
states: [
23+
State {
24+
name: "FILLED"
25+
PropertyChanges {
26+
target: root
27+
iconColor: Theme.color.neutral9
28+
textColor: Theme.color.neutral7
29+
}
30+
},
31+
State {
32+
name: "HOVER"
33+
PropertyChanges {
34+
target: root
35+
iconColor: Theme.color.orangeLight1
36+
textColor: Theme.color.orangeLight1
37+
}
38+
},
39+
State {
40+
name: "ACTIVE"
41+
PropertyChanges {
42+
target: root
43+
iconColor: Theme.color.orange
44+
textColor: Theme.color.orange
45+
}
46+
}
47+
]
1748

1849
contentItem: RowLayout {
1950
spacing: 0
@@ -26,9 +57,13 @@ AbstractButton {
2657
font.family: "Inter"
2758
font.styleName: "Regular"
2859
font.pixelSize: root.descriptionSize
29-
color: Theme.color.neutral7
60+
color: root.textColor
3061
textFormat: Text.RichText
31-
text: "<style>a:link { color: " + Theme.color.neutral7 + "; text-decoration: none;}</style>" + "<a href=\"" + link + "\">" + root.description + "</a>"
62+
text: root.description
63+
64+
Behavior on color {
65+
ColorAnimation { duration: 150 }
66+
}
3267
}
3368
}
3469
Loader {
@@ -37,11 +72,15 @@ AbstractButton {
3772
visible: active
3873
sourceComponent: Button {
3974
icon.source: root.iconSource
40-
icon.color: Theme.color.neutral9
75+
icon.color: root.iconColor
4176
icon.height: root.iconHeight
4277
icon.width: root.iconWidth
4378
background: null
4479
onClicked: root.clicked()
80+
81+
Behavior on icon.color {
82+
ColorAnimation { duration: 150 }
83+
}
4584
}
4685
}
4786
}

0 commit comments

Comments
 (0)