Skip to content

Commit 1441d5b

Browse files
committed
qml: Add BlockCounter QML component prototype
1 parent b6280a9 commit 1441d5b

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

src/qml/bitcoin_qml.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!DOCTYPE RCC><RCC version="1.0">
22
<qresource prefix="/qml">
3+
<file>components/BlockCounter.qml</file>
34
<file>pages/initerrormessage.qml</file>
45
<file>pages/stub.qml</file>
56
</qresource>

src/qml/components/BlockCounter.qml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2021 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+
// The BlockCounter component.
6+
7+
import QtQuick 2.12
8+
import QtQuick.Controls 2.12
9+
10+
Label {
11+
property int blockHeight: 0
12+
background: Rectangle {
13+
color: "black"
14+
}
15+
color: "orange"
16+
padding: 16
17+
horizontalAlignment: Text.AlignHCenter
18+
verticalAlignment: Text.AlignVCenter
19+
font.pixelSize: height / 3
20+
text: blockHeight
21+
}

src/qml/pages/stub.qml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
import QtQml 2.12
5+
import QtQuick 2.12
66
import QtQuick.Controls 2.12
7+
import "../components" as BitcoinCoreComponents
8+
79

810
ApplicationWindow {
911
id: appWindow
@@ -13,4 +15,11 @@ ApplicationWindow {
1315
visible: true
1416

1517
Component.onCompleted: nodeModel.startNodeInitializionThread();
18+
19+
BitcoinCoreComponents.BlockCounter {
20+
id: blockCounter
21+
anchors.centerIn: parent
22+
height: parent.height / 3
23+
blockHeight: nodeModel.blockTipHeight
24+
}
1625
}

0 commit comments

Comments
 (0)