Skip to content

Commit c46517b

Browse files
committed
qml: Add QRImage control
1 parent 9e1f8a0 commit c46517b

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

qml/bitcoin_qml.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<file>controls/PageIndicator.qml</file>
4848
<file>controls/PageStack.qml</file>
4949
<file>controls/ProgressIndicator.qml</file>
50+
<file>controls/QRImage.qml</file>
5051
<file>controls/qmldir</file>
5152
<file>controls/SendOptionsPopup.qml</file>
5253
<file>controls/Setting.qml</file>

qml/controls/QRImage.qml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) 2025 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+
7+
Image {
8+
id: root
9+
10+
property string code: ""
11+
property color backgroundColor: Qt.black
12+
property color foregroundColor: Qt.white
13+
14+
fillMode: Image.PreserveAspectFit
15+
smooth: false
16+
source: `image://qr/${encodeURIComponent(root.code)}?&fg=${encodeURIComponent(root.foregroundColor)}&bg=${encodeURIComponent(root.backgroundColor)}`
17+
}

qml/pages/wallet/RequestPayment.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ Page {
199199
clearRequest.visible = true
200200
title.text = qsTr("Payment request #" + requestCounter)
201201
address.text = "bc1q f5xe y2tf 89k9 zy6k gnru wszy 5fsa truy 9te1 bu"
202+
qrImage.code = "bc1qf5xey2tf89k9zy6kgnruwszy5fsatruy9te1bu"
202203
continueButton.text = qsTr("Copy payment request")
203204
}
204205
}

0 commit comments

Comments
 (0)