Skip to content

Commit b2c1a15

Browse files
committed
qml: Introduce AddWalletButton
1 parent a38cf5b commit b2c1a15

File tree

4 files changed

+90
-22
lines changed

4 files changed

+90
-22
lines changed

src/Makefile.qt.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ QML_RES_QML = \
382382
qml/components/ThemeSettings.qml \
383383
qml/components/TotalBytesIndicator.qml \
384384
qml/components/Tooltip.qml \
385+
qml/controls/AddWalletButton.qml \
385386
qml/controls/CaretRightIcon.qml \
386387
qml/controls/ContinueButton.qml \
387388
qml/controls/CoreText.qml \

src/qml/bitcoin_qml.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<file>components/ThemeSettings.qml</file>
2121
<file>components/TotalBytesIndicator.qml</file>
2222
<file>components/Tooltip.qml</file>
23+
<file>controls/AddWalletButton.qml</file>
2324
<file>controls/ContinueButton.qml</file>
2425
<file>controls/CoreText.qml</file>
2526
<file>controls/CoreTextField.qml</file>

src/qml/controls/AddWalletButton.qml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// Copyright (c) 2024 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
import QtQuick.Layouts 1.15
8+
9+
import org.bitcoincore.qt 1.0
10+
11+
Button {
12+
id: root
13+
14+
property color bgActiveColor: Theme.color.neutral2
15+
property color textColor: Theme.color.neutral7
16+
property color textHoverColor: Theme.color.orange
17+
property color textActiveColor: Theme.color.orange
18+
19+
hoverEnabled: AppMode.isDesktop
20+
implicitHeight: 30
21+
implicitWidth: 220
22+
23+
MouseArea {
24+
anchors.fill: parent
25+
enabled: false
26+
hoverEnabled: true
27+
cursorShape: Qt.PointingHandCursor
28+
}
29+
30+
contentItem: Item {
31+
anchors.fill: parent
32+
RowLayout {
33+
anchors.centerIn: parent
34+
spacing: 3
35+
Icon {
36+
id: addIcon
37+
Layout.alignment: Qt.AlignRight
38+
source: "image://images/plus"
39+
color: Theme.color.neutral7
40+
size: 16
41+
Layout.minimumWidth: 16
42+
Layout.preferredWidth: 16
43+
Layout.maximumWidth: 16
44+
}
45+
CoreText {
46+
id: addText
47+
Layout.fillHeight: true
48+
Layout.alignment: Qt.AlignLeft
49+
text: qsTr("Add Wallet")
50+
color: Theme.color.neutral7
51+
font.pixelSize: 15
52+
}
53+
}
54+
}
55+
56+
background: Rectangle {
57+
id: bg
58+
height: 30
59+
width: 220
60+
radius: 5
61+
color: Theme.color.neutral3
62+
visible: root.hovered || root.checked
63+
64+
FocusBorder {
65+
visible: root.visualFocus
66+
}
67+
68+
Behavior on color {
69+
ColorAnimation { duration: 150 }
70+
}
71+
}
72+
73+
states: [
74+
State {
75+
name: "CHECKED"; when: root.checked
76+
},
77+
State {
78+
name: "HOVER"; when: root.hovered
79+
PropertyChanges { target: addText; color: textHoverColor }
80+
PropertyChanges { target: addIcon; color: textHoverColor }
81+
}
82+
]
83+
}

src/qml/pages/wallet/WalletSelect.qml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Popup {
1212
id: root
1313

1414
property alias model: listView.model
15-
implicitHeight: layout.height + arrow.height
15+
implicitHeight: layout.height + arrow.height + 11
1616
implicitWidth: 250
1717
clip: true
1818

@@ -89,29 +89,12 @@ Popup {
8989
}
9090
}
9191

92-
RowLayout {
92+
AddWalletButton {
9393
id: addWallet
94-
Layout.preferredWidth: addIcon.size + addText.width
95-
Layout.preferredHeight: 45
94+
9695
Layout.alignment: Qt.AlignHCenter
97-
Icon {
98-
id: addIcon
99-
Layout.alignment: Qt.AlignHCenter
100-
source: "image://images/plus"
101-
color: Theme.color.neutral8
102-
size: 14
103-
topPadding: 5
104-
bottomPadding: 10
105-
}
106-
CoreText {
107-
id: addText
108-
Layout.alignment: Qt.AlignHCenter
109-
text: qsTr("Add Wallet")
110-
color: Theme.color.neutral9
111-
font.pixelSize: 15
112-
topPadding: 5
113-
bottomPadding: 10
114-
}
96+
Layout.preferredWidth: 220
97+
Layout.preferredHeight: 30
11598
}
11699
}
117100
}

0 commit comments

Comments
 (0)