Skip to content

Commit 50b7b22

Browse files
committed
qml: Add BlockCounter QML component prototype
Github-Pull: bitcoin-core#31 Rebased-From: 1441d5b
1 parent ba7c50a commit 50b7b22

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

src/qml/BitcoinApp/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ qt6_add_qml_module(bitcoin_qml
1616
stub.qml
1717
)
1818

19+
add_subdirectory(Components)
20+
1921
target_link_libraries(bitcoin_qml
2022
INTERFACE
2123
bitcoin_qmlplugin
24+
bitcoin_qml_componentsplugin
2225
PUBLIC
2326
Qt6::Widgets
2427
Qt6::Quick
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
8+
import QtQuick.Controls
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+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2025-present The Bitcoin Core developers
2+
# Distributed under the MIT software license, see the accompanying
3+
# file COPYING or https://opensource.org/license/mit/.
4+
5+
qt6_add_qml_module(bitcoin_qml_components
6+
URI BitcoinApp.Components
7+
VERSION 1.0
8+
STATIC
9+
RESOURCE_PREFIX /qt/qml/
10+
QML_FILES
11+
BlockCounter.qml
12+
)

src/qml/BitcoinApp/stub.qml

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

5-
import QtQml
5+
import QtQuick
66
import QtQuick.Controls
7+
import BitcoinApp.Components
78

89
ApplicationWindow {
910
id: appWindow
@@ -13,4 +14,11 @@ ApplicationWindow {
1314
visible: true
1415

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

0 commit comments

Comments
 (0)