forked from akhenakh/mocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPageCam.qml
69 lines (59 loc) · 1.55 KB
/
PageCam.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
import QtQuick 2.0
import QtQuick.Controls 2.3
import QtMultimedia 5.4
Item {
Rectangle {
id: camRect
color: "#000054"
width: 650
height: 430
anchors.left: parent.left
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: 0
Camera {
id: camera
captureMode: Camera.CaptureVideo
videoRecorder {
}
//deviceId: "/dev/video2"
}
VideoOutput {
source: camera
anchors.fill: parent
fillMode: PreserveAspectFit
}
}
onVisibleChanged: {
if (!pageCam.visible ) {
camera.stop()
console.log("camera stopped")
} else {
camera.start()
console.log("camera started")
}
}
ListView {
id: deviceView
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: camRect.right
anchors.leftMargin: 0
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.top: parent.top
anchors.topMargin: 0
model: QtMultimedia.availableCameras
delegate: Text {
text: modelData.displayName + " " + modelData.deviceId
color: "white"
MouseArea {
anchors.fill: parent
onClicked: {
console.log("changed camera to", modelData.deviceId);
camera.deviceId = modelData.deviceId
}
}
}
}
}