Warning, /frameworks/prison/tests/scanner-qt5.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 5.15 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 source: camera 0021 filters: [scanner] 0022 } 0023 0024 Prison.VideoScanner { 0025 id: scanner 0026 // formats: Prison.Format.QRCode | Prison.Format.Aztec 0027 onResultChanged: { 0028 if (result.hasText) { 0029 console.log(result.text, result.format); 0030 } else if (result.hasBinaryData) { 0031 console.log("<binary content>", result.format); 0032 } else { 0033 console.log("no barcode found"); 0034 } 0035 } 0036 } 0037 0038 Camera { 0039 id: camera 0040 } 0041 0042 Rectangle { 0043 color: "#80ff0000" 0044 x: viewFinder.mapRectToItem(scanner.result.boundingRect).x 0045 y: viewFinder.mapRectToItem(scanner.result.boundingRect).y 0046 width: viewFinder.mapRectToItem(scanner.result.boundingRect).width 0047 height: viewFinder.mapRectToItem(scanner.result.boundingRect).height 0048 } 0049 }