You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
6.0 KiB

6 months ago
/******************************************************************
Copyright © Deng Zhimao Co., Ltd. 1990-2030. All rights reserved.
* @projectName aflex
* @brief Aflex.qml
* @author Deng Zhimao
* @email 1252699831@qq.com
* @date 2020-07-25
*******************************************************************/
import QtQuick 2.9
import QtQuick 2.0
import QtQuick.Window 2.2
//import QtQuick.Controls 2.14
import QtQuick.Controls 2.5
import adc 1.0
import dac 1.0
import "../helpbutton"
Item {
property string adcDataText
property int dacValue
property bool flag: false
id: aflex
visible: false
HelpMessages {
anchors.fill: parent
z: 105
appIcon: WINStyle ? "" : "qrc:/desktop/androidstyleicons/aflex.png"
appName: "电压测量"
appVersion: "Version 1.0.1"
subtoolText: "1.ADCDACADCDAC±3.3v,cpu
2.使StartADCDAC线退"
versionText: "1.【Version 1.0.0 2020-10-15】。\n初始版本\n2.【Version 1.0.1 2020-12-09】。\n兼容480x272分辨率"
}
onVisibleChanged: {
formState.state == 'right' ? formState.state = '' : formState.state = 'right'
if (parent.visible){
flag = false
if(!WINenv)
adc.setCapture(flag)
else
adcDataText = "0.0"
}
}
Component.onCompleted: {
aflex.x = parent.width
}
Item {
id: formState
states: State {
name: "right"
PropertyChanges {
target: aflex
x: 0
}
}
transitions: Transition {
NumberAnimation {
property: "x"
easing.type: Easing.InOutQuart
duration: 500
}
}
}
Adc{
id: adc
onAdcDataChanged: {
adcDataText = adcData
}
}
Dac{
id : dac
}
Flickable {
anchors.fill: parent
interactive: smallScreen ? true : false
contentWidth: smallScreen ? parent.width + 320 : parent.width
contentHeight: smallScreen ? parent.height + 208 : parent.height
ScrollBar.vertical: ScrollBar {
visible: smallScreen ? true : false
id: scrollBarVertical1
z: 20
width: 5
hoverEnabled: true
background: Rectangle {color: "#33bbbbbb"}
onActiveChanged: {
active = true;
}
Component.onCompleted: {
scrollBarVertical1.active = true;
}
contentItem: Rectangle{
implicitWidth: 5
implicitHeight: 100
radius: 2
color: scrollBarVertical1.hovered ? "#25cfea" : "#88bbbbbb"
}
}
ScrollBar.horizontal: ScrollBar {
visible: smallScreen ? true : false
id: scrollBarHorizontal1
z: 20
height: 5
hoverEnabled: true
background: Rectangle {color: "#33bbbbbb"}
onActiveChanged: {
active = true;
}
Component.onCompleted: {
scrollBarHorizontal1.active = true;
}
contentItem: Rectangle{
implicitWidth: 100
implicitHeight: 5
radius: 2
color: scrollBarHorizontal1.hovered ? "#25cfea" : "#88bbbbbb"
}
}
Text {
id: dac_text
text: qsTr("DAC")
anchors.bottom: myDial.top
anchors.bottomMargin: -20
anchors.horizontalCenter: myDial.horizontalCenter
color: "white"
font.pixelSize: 50
font.bold: true
}
MyDial{
id: myDial
anchors.left: parent.horizontalCenter
anchors.leftMargin: 30
anchors.verticalCenter: parent.verticalCenter
onMyDialVauleChange: {
if(!WINenv){
dacValue = dialVaule / 0.805664062;
dac.setDac(dacValue)
}
}
}
Text {
id: adc_text
text: qsTr("ADC")
anchors.bottom: adcbg.top
anchors.bottomMargin: 20
anchors.horizontalCenter: adcbg.horizontalCenter
color: "white"
font.pixelSize: 50
font.bold: true
}
Image {
id: adcbg
width: 230
height: 230
anchors.right: parent.horizontalCenter
anchors.rightMargin: 30
anchors.verticalCenter: parent.verticalCenter
source: "qrc:/aflex/images/dialbg.png"
MouseArea{
anchors.fill: parent
onClicked: {
flag = !flag
if(!WINenv)
adc.setCapture(flag)
}
}
Rectangle{
anchors.centerIn: parent
width: 200
height: 200
radius: width / 2
color: "gray"
Text {
id: adcText
text: flag ? adcDataText : "Start"
color: "white"
font.pixelSize: 50
anchors.centerIn: parent
}
Text {
id: unit_text
text: flag ? qsTr("mV") : ""
anchors.bottom: adcText.bottom
color: "white"
anchors.left: adcText.right
font.bold: true
font.pixelSize: 15
}
}
}
}
}