From 959d481e939567ced255bb536a1370a3d6071b0a Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 24 Apr 2023 12:39:29 +0200 Subject: [PATCH] qml: create ScanDialog --- electrum/gui/qml/components/ScanDialog.qml | 45 ++++++++++++++++++++++ electrum/gui/qml/components/main.qml | 8 ++++ 2 files changed, 53 insertions(+) create mode 100644 electrum/gui/qml/components/ScanDialog.qml diff --git a/electrum/gui/qml/components/ScanDialog.qml b/electrum/gui/qml/components/ScanDialog.qml new file mode 100644 index 000000000..3a8f6ed21 --- /dev/null +++ b/electrum/gui/qml/components/ScanDialog.qml @@ -0,0 +1,45 @@ +import QtQuick 2.6 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.0 + +import "controls" + +ElDialog { + id: scanDialog + + property string scanData + property string error + property string hint + + signal found + + width: parent.width + height: parent.height + padding: 0 + + header: null + topPadding: 0 // dialog needs topPadding override + + ColumnLayout { + anchors.fill: parent + spacing: 0 + + QRScan { + Layout.fillWidth: true + Layout.fillHeight: true + hint: scanDialog.hint + onFound: { + scanDialog.scanData = scanData + scanDialog.found() + } + } + + FlatButton { + id: button + Layout.fillWidth: true + text: qsTr('Cancel') + icon.source: '../../icons/closebutton.png' + onClicked: doReject() + } + } +} diff --git a/electrum/gui/qml/components/main.qml b/electrum/gui/qml/components/main.qml index c1695ce5b..66353a24d 100644 --- a/electrum/gui/qml/components/main.qml +++ b/electrum/gui/qml/components/main.qml @@ -361,6 +361,14 @@ ApplicationWindow } } + property alias scanDialog: _scanDialog + Component { + id: _scanDialog + ScanDialog { + onClosed: destroy() + } + } + property alias channelOpenProgressDialog: _channelOpenProgressDialog ChannelOpenProgressDialog { id: _channelOpenProgressDialog