-
Notifications
You must be signed in to change notification settings - Fork 37
/
Qt6ScannerPage.qml
94 lines (65 loc) · 1.62 KB
/
Qt6ScannerPage.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import QtQuick
import QtQuick.Controls
import QtMultimedia
import com.scythestudio.scodes 1.0
/*!
Barcode scanner main page. All QML elements managing from here.
*/
ApplicationWindow {
id: root
width: Qt.platform.os === "android"
|| Qt.platform.os === "ios" ? Screen.width : 1280
height: Qt.platform.os === "android"
|| Qt.platform.os === "ios" ? Screen.height : 720
visible: true
SBarcodeScanner {
id: barcodeScanner
forwardVideoSink: videoOutput.videoSink
scanning: !resultScreen.visible
captureRect: Qt.rect(1 / 4, 1 / 4, 1 / 2, 1 / 2)
onCapturedChanged: function (captured) {
scanResultText.text = captured
resultScreen.visible = true
}
}
VideoOutput {
id: videoOutput
anchors.fill: parent
width: root.width
focus: visible
fillMode: VideoOutput.PreserveAspectCrop
}
Qt6ScannerOverlay {
id: scannerOverlay
anchors.fill: parent
captureRect: barcodeScanner.captureRect
}
Rectangle {
id: resultScreen
anchors.fill: parent
visible: false
Column {
anchors.centerIn: parent
spacing: 20
Text {
id: scanResultText
anchors.horizontalCenter: parent.horizontalCenter
color: Theme.textColor
}
Button {
id: scanButton
anchors.horizontalCenter: parent.horizontalCenter
implicitWidth: 100
implicitHeight: 50
Text {
anchors.centerIn: parent
text: qsTr("Scan again")
color: Theme.textColor
}
onClicked: {
resultScreen.visible = false
}
}
}
}
}