Warning, /frameworks/prison/tests/scanner-qt6.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: MIT
0004 */
0005 
0006 import QtQuick 2.15
0007 import QtQuick.Controls 2.15
0008 import QtQuick.Layouts 1.15
0009 import QtMultimedia 6.2
0010 import org.kde.prison.scanner 1.0 as Prison
0011 
0012 ApplicationWindow {
0013     width: 1024
0014     height: 768
0015     visible: true
0016 
0017     VideoOutput {
0018         id: viewFinder
0019         anchors.fill: parent
0020     }
0021 
0022     Prison.VideoScanner {
0023         id: scanner
0024         formats: Prison.Format.QRCode | Prison.Format.Aztec
0025         onResultChanged: console.log(result.text, result.format);
0026         videoSink: viewFinder.videoSink
0027     }
0028 
0029     CaptureSession {
0030         camera: Camera {
0031             id: camera
0032         }
0033         videoOutput: viewFinder
0034     }
0035 
0036     Rectangle {
0037         color: "#80ff0000"
0038         x: viewFinder.contentRect.x + scanner.result.boundingRect.x / viewFinder.sourceRect.width * viewFinder.contentRect.width
0039         y: viewFinder.contentRect.y + scanner.result.boundingRect.y / viewFinder.sourceRect.height * viewFinder.contentRect.height
0040         width: scanner.result.boundingRect.width / viewFinder.sourceRect.width * viewFinder.contentRect.width
0041         height: scanner.result.boundingRect.height / viewFinder.sourceRect.height * viewFinder.contentRect.height
0042     }
0043 }
0044