Skip to content

Commit f4dc006

Browse files
committed
qml: introduce NavButton control
1 parent 024b470 commit f4dc006

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

src/Makefile.qt.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ QML_RES_QML = \
315315
qml/controls/ContinueButton.qml \
316316
qml/controls/ExternalLink.qml \
317317
qml/controls/Header.qml \
318+
qml/controls/NavButton.qml \
318319
qml/controls/PageIndicator.qml \
319320
qml/controls/OnboardingInfo.qml \
320321
qml/controls/OptionButton.qml \

src/qml/bitcoin_qml.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<file>controls/ContinueButton.qml</file>
1212
<file>controls/ExternalLink.qml</file>
1313
<file>controls/Header.qml</file>
14+
<file>controls/NavButton.qml</file>
1415
<file>controls/PageIndicator.qml</file>
1516
<file>controls/OnboardingInfo.qml</file>
1617
<file>controls/OptionButton.qml</file>

src/qml/controls/NavButton.qml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright (c) 2022 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+
AbstractButton {
10+
id: root
11+
property int iconHeight: 30
12+
property int iconWidth: 30
13+
property int textSize: 18
14+
property url iconSource: ""
15+
16+
padding: 0
17+
background: null
18+
contentItem: RowLayout {
19+
anchors.fill: parent
20+
spacing: 0
21+
Loader {
22+
id: button_background
23+
active: root.iconSource.toString().length > 0
24+
visible: active
25+
sourceComponent: Button {
26+
id: icon_button
27+
padding: 0
28+
display: AbstractButton.IconOnly
29+
height: root.iconHeight
30+
width: root.iconWidth
31+
icon.source: root.iconSource
32+
icon.color: Theme.color.neutral9
33+
icon.height: root.iconHeight
34+
icon.width: root.iconWidth
35+
background: null
36+
onClicked: root.clicked()
37+
}
38+
}
39+
Loader {
40+
active: root.text.length > 0
41+
visible: active
42+
sourceComponent: AbstractButton {
43+
id: container
44+
padding: 0
45+
font.family: "Inter"
46+
font.styleName: "Semi Bold"
47+
font.pixelSize: root.textSize
48+
background: null
49+
contentItem: Text {
50+
anchors.verticalCenter: parent.verticalCenter
51+
font: container.font
52+
color: Theme.color.neutral9
53+
text: root.text
54+
}
55+
onClicked: root.clicked()
56+
}
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)