Skip to content

Commit 9bc8a6d

Browse files
committed
qml: Add NodeModel module
1 parent 4d7ce14 commit 9bc8a6d

File tree

5 files changed

+34
-1
lines changed

5 files changed

+34
-1
lines changed

src/Makefile.qt.include

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ QT_FORMS_UI = \
3535
qt/forms/transactiondescdialog.ui
3636

3737
QT_MOC_CPP = \
38+
qml/moc_nodemodel.cpp \
3839
qt/moc_addressbookpage.cpp \
3940
qt/moc_addresstablemodel.cpp \
4041
qt/moc_askpassphrasedialog.cpp \
@@ -107,6 +108,7 @@ QT_QRC_LOCALE = qt/bitcoin_locale.qrc
107108

108109
BITCOIN_QT_H = \
109110
qml/bitcoin.h \
111+
qml/nodemodel.h \
110112
qt/addressbookpage.h \
111113
qt/addresstablemodel.h \
112114
qt/askpassphrasedialog.h \
@@ -281,7 +283,8 @@ BITCOIN_QT_WALLET_CPP = \
281283
qt/walletview.cpp
282284

283285
BITCOIN_QML_BASE_CPP = \
284-
qml/bitcoin.cpp
286+
qml/bitcoin.cpp \
287+
qml/nodemodel.cpp
285288

286289
QML_QRC_CPP = qml/qrc_bitcoin.cpp
287290
QML_QRC = qml/bitcoin_qml.qrc

src/qml/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/moc_*.cpp

src/qml/bitcoin.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <node/context.h>
1010
#include <node/ui_interface.h>
1111
#include <noui.h>
12+
#include <qml/nodemodel.h>
1213
#include <qt/guiconstants.h>
1314
#include <util/system.h>
1415
#include <util/translation.h>
@@ -18,6 +19,7 @@
1819

1920
#include <QGuiApplication>
2021
#include <QQmlApplicationEngine>
22+
#include <QQmlContext>
2123
#include <QStringLiteral>
2224
#include <QUrl>
2325

@@ -46,7 +48,12 @@ int QmlGuiMain(int argc, char* argv[])
4648

4749
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
4850
QGuiApplication app(argc, argv);
51+
52+
NodeModel node_model;
53+
4954
QQmlApplicationEngine engine;
55+
engine.rootContext()->setContextProperty("nodeModel", &node_model);
56+
5057
engine.load(QUrl(QStringLiteral("qrc:///qml/pages/stub.qml")));
5158
if (engine.rootObjects().isEmpty()) {
5259
return EXIT_FAILURE;

src/qml/nodemodel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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+
#include <qml/nodemodel.h>

src/qml/nodemodel.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
#ifndef BITCOIN_QML_NODEMODEL_H
6+
#define BITCOIN_QML_NODEMODEL_H
7+
8+
#include <QObject>
9+
10+
/** Model for Bitcoin network client. */
11+
class NodeModel : public QObject
12+
{
13+
Q_OBJECT
14+
15+
};
16+
17+
#endif // BITCOIN_QML_NODEMODEL_H

0 commit comments

Comments
 (0)