SmartLockerTools/Analyser/qml/main.qml
2024-08-05 17:42:27 +08:00

133 lines
3.6 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Analyser
Window {
width: 1120
height: 680
visible: true
title: qsTr(Qt.application.name + " " + Qt.application.version)
OperationItem {
id: operationItem
width: 450
anchors.top: parent.top
}
Item {
id: resultGroupBox
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
width: 220
Text {
id: resultGroupBoxTitle
text: "识别结果"
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: 30
}
ScrollView {
id: resultView
anchors.left: parent.left
anchors.right: parent.right
anchors.top: resultGroupBoxTitle.bottom
anchors.bottom: parent.bottom
TextArea {
id: resultBrowser
font.pixelSize: 14
readOnly: true
wrapMode: TextArea.WordWrap
}
}
Button {
text: "清空"
anchors.right: parent.right
anchors.bottom: parent.bottom
onClicked: resultBrowser.clear()
}
}
ColumnLayout {
anchors.left: operationItem.right
anchors.right: resultGroupBox.left
anchors.top: parent.top
anchors.bottom: parent.bottom
TabBar {
id: bar
width: parent.width
TabButton {
implicitWidth: 100
text: qsTr("视频流")
}
TabButton {
text: qsTr("日志")
}
}
StackLayout {
width: parent.width
currentIndex: bar.currentIndex
clip: true
Image {
id: image
cache: false
fillMode: Image.PreserveAspectFit
rotation: 90
source: "image://videoframe/"
}
Item {
ScrollView {
id: view
anchors.fill: parent
TextArea {
id: logBrowser
readOnly: true
wrapMode: TextArea.WordWrap
}
}
Button {
text: "清空"
anchors.right: parent.right
anchors.bottom: parent.bottom
onClicked: logBrowser.clear()
}
}
}
}
Connections {
target: App
function onNewLog(text) {
logBrowser.append(text)
}
function onNewStatusTip(level, tip) {
if (level === 0) {
statusTip.icon = "../resources/successfull.svg"
statusTip.color = "#EBF8ED"
statusTip.show(tip, 2000)
} else if (level === 1) {
statusTip.icon = "../resources/warning.svg"
statusTip.color = "#FAFAD2"
statusTip.show(tip, 2000)
} else if (level === 2) {
resultBrowser.append(tip)
}
console.log(level, Application.Info)
}
function onNewVideoFrame() {
image.source = ""
image.source = "image://videoframe/"
}
}
StatusTip {
id: statusTip
width: 200
height: 50
icon: "../resources/successfull.svg"
}
}