-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCameraWidget.qml
More file actions
91 lines (85 loc) · 2.36 KB
/
CameraWidget.qml
File metadata and controls
91 lines (85 loc) · 2.36 KB
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
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtMultimedia 5.12
Item {
Popup {
id: campopup
modal: true
focus: true
margins: 50
parent: root.parent
width: parent.width-100
height: width*0.75
onOpened: camera.start()
onClosed: camera.stop()
Component.onCompleted: {
camera.stop()
}
Camera {
id: camera
captureMode: Camera.CaptureStillImage
imageCapture.onImageSaved:{
campopup.close()
}
}
VideoOutput {
id: vid_out
source: camera
Component.onCompleted: {
VideoOutput.source._q_reregisterTimers()
console.log(camera.viewfinder.resolution.width+" "+camera.viewfinder.resolution.height)
campopup.height=campopup.width*camera.viewfinder.resolution.width/camera.viewfinder.resolution.height
}
anchors.fill: parent
autoOrientation: true
fillMode: VideoOutput.PreserveAspectFit
focus : visible
}
RoundButton {
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
icon.source: "qrc:/icons/camera-outline.png"
onClicked: {
var fn="annot_"+Qt.formatDateTime(new Date(),"yyMMdd_hhmmss.jpg")
camera.imageCapture.captureToLocation(fn)
filename.text=fn
}
}
}
id: root
signal reset()
property string label: 'Photo'
property string stringvalue: '\t'
property string value: ''
onReset: {
filename.text=''
}
implicitHeight: row.height
implicitWidth: row.width
Row{
id: row
spacing: 10
Label{
text: root.label
anchors.verticalCenter: parent.verticalCenter
}
TextField{
id: filename
enabled: false
width: 250
text: ''
onTextChanged: {
root.valuetext
root.stringvalue=text+'\t'
}
}
ToolButton{
id: startcam
icon.source: "qrc:/icons/camera-outline.png"
onClicked: {
campopup.open()
}
}
}
}