-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQRGenerator.qml
44 lines (38 loc) · 1.15 KB
/
QRGenerator.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import QtQuick
import "qrcode.min.js" as QrSvg
QtObject {
id: root
required property string content
property int padding: 4
property int width: 256
property int height: 256
property string color: "black"
property string background: "white"
property string ecl: "M"
property bool join: false
property bool predefined: false
property bool pretty: true
property bool swap: false
property bool xmlDeclaration: true
property string container: "svg"
property string svgString: ""
function createSvgString() {
root.svgString = new QrSvg.QRCode({
content: root.content,
padding: root.padding,
width: root.width,
height: root.height,
color: root.color,
background: root.background,
ecl: root.ecl,
join: root.join,
predefined: root.predefined,
pretty: root.pretty,
swap: root.swap,
xmlDeclaration: root.xmlDeclaration,
container: root.container
}).svg()
}
onContentChanged: createSvgString()
Component.onCompleted: createSvgString()
}