Hide "Scan a QR Code" with no camera connected

Also when you disconnect/turn off the camera while the QR scanner is
open, show a better error message instead of freezing the last frame.
This commit is contained in:
Joshua Goins
2025-09-09 16:43:26 +02:00
parent c93ce52ba1
commit 877d5f34f7
2 changed files with 25 additions and 0 deletions

View File

@@ -27,9 +27,26 @@ Kirigami.Page {
}
}
MediaDevices {
id: devices
}
Rectangle {
anchors.fill: parent
color: Kirigami.Theme.backgroundColor
visible: devices.videoInputs.length === 0
Kirigami.PlaceholderMessage {
text: i18nc("@info", "No Camera Connected")
anchors.centerIn: parent
}
}
VideoOutput {
id: viewFinder
anchors.centerIn: parent
visible: devices.videoInputs.length > 0
}
Prison.VideoScanner {
@@ -47,6 +64,8 @@ Kirigami.Page {
}
CaptureSession {
id: session
camera: Camera {
id: camera
}