-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathQRCode.qml
50 lines (43 loc) · 1.07 KB
/
QRCode.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
45
46
47
48
49
50
import QtQuick 2.0
import "qqr.js" as QRCodeBackend
Canvas {
id: canvas
// background colour to be used
property color background : "white"
// foreground colour to be used
property color foreground : "black"
// ECC level to be applied (e.g. L, M, Q, H)
property string level : "L"
// value to be encoded in the generated QR code
property string value : ""
onPaint : {
var qr = QRCodeBackend.get_qr()
qr.canvas({
background : canvas.background,
canvas : canvas,
value: canvas.value,
foreground : canvas.foreground,
level : canvas.level,
side : Math.min(canvas.width, canvas.height),
value : canvas.value
})
}
onHeightChanged : {
requestPaint()
}
onWidthChanged : {
requestPaint()
}
onBackgroundChanged : {
requestPaint()
}
onForegroundChanged : {
requestPaint()
}
onLevelChanged : {
requestPaint()
}
onValueChanged : {
requestPaint()
}
}