save qrcode to file

This commit is contained in:
MoroccanMalinois
2017-01-23 04:15:49 +00:00
parent 6d73fba14c
commit 1d7a1f6d53
5 changed files with 51 additions and 1 deletions

View File

@@ -358,6 +358,32 @@ Rectangle {
standardButtons: StandardButton.Ok
}
FileDialog {
id: qrFileDialog
title: "Please choose a name"
folder: shortcuts.pictures
selectExisting: false
nameFilters: [ "Image (*.png)"]
onAccepted: {
if( ! walletManager.saveQrCode(makeQRCodeString(), walletManager.urlToLocalPath(fileUrl))) {
console.log("Failed to save QrCode to file " + walletManager.urlToLocalPath(fileUrl) )
trackingHowToUseDialog.title = qsTr("Save QrCode") + translationManager.emptyString;
trackingHowToUseDialog.text = qsTr("Failed to save QrCode to ") + walletManager.urlToLocalPath(fileUrl) + translationManager.emptyString;
trackingHowToUseDialog.icon = StandardIcon.Error
trackingHowToUseDialog.open()
}
}
}
Menu {
id: qrMenu
title: "QrCode"
MenuItem {
text: qsTr("Save As")
onTriggered: qrFileDialog.open()
}
}
Image {
id: qrCode
anchors.margins: 50
@@ -367,6 +393,15 @@ Rectangle {
smooth: false
fillMode: Image.PreserveAspectFit
source: "image://qrcode/" + makeQRCodeString()
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: {
if (mouse.button == Qt.RightButton)
qrMenu.popup()
}
onPressAndHold: qrFileDialog.open()
}
}
}