2 Star 1 Fork 0

ducksoul / SGXExpress

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
HomePage.qml 6.72 KB
一键复制 编辑 原始数据 按行查看 历史
import QtQuick 2.15
import QtQuick.Controls 2.15
Page {
id: page
property alias comboBox: comboBox
property bool deviceConnect: false
property real buttonSize: grid.width / 4
signal triggerConnect(var id)
signal triggerDisconnect()
signal enterTest()
signal enterAnalyzer()
signal enterLogger()
signal triggerSGX6000Config()
signal triggerSX666Config()
title: qsTr("SGX Express")
function triggerconfig(val) {
if (val === 0)
{
triggerSGX6000Config();
}
if (val === 1)
{
triggerSX666Config();
}
}
Grid{
id: grid
anchors.top: parent.top
spacing: parent.width / 10
anchors.rightMargin: parent.width / 10
anchors.leftMargin: parent.width / 10
anchors.topMargin: parent.height / 6
verticalItemAlignment: Grid.AlignVCenter
horizontalItemAlignment: Grid.AlignHCenter
columns: 3
height: parent.height * 3 / 5
anchors.left: parent.left
anchors.right: parent.right
rows: 1
AbstractButton {
id: button_logger
width: parent.width / 4
height: parent.height
//enabled: deviceConnect
Column{
id: column2
width: parent.width
height: parent.height
Image {
id: loggerImage
fillMode: Image.PreserveAspectFit
source: "qrc:/resources/log.png"
height: parent.height * 3 / 4
width: parent.height * 3 / 4
}
Label
{
text: qsTr("Logger")
font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: "Verdana"
font.bold: deviceConnect
width: parent.width
height: parent.height - loggerImage.height
color: "#1a1b1d"
}
}
onClicked: enterLogger()
}
AbstractButton {
id: button_analyzer
width: parent.width / 4
height: parent.height
enabled: deviceConnect
//anchors.verticalCenter: parent.verticalCenter
//anchors.horizontalCenter: parent.horizontalCenter
Column{
id: column
width: parent.width
height: parent.height
Image {
id: analyzerImage
fillMode: Image.PreserveAspectFit
source: "qrc:/resources/data.png"
height: parent.height * 3 / 4
width: height * 1.18
}
Label
{
text: qsTr("Analyzer")
font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: "Verdana"
font.bold: deviceConnect
width: analyzerImage.width
height: parent.height - analyzerImage.height
color: "#1a1b1d"
}
}
onClicked: enterAnalyzer()
}
AbstractButton {
id: button_test
width: parent.width / 4
height: parent.height
enabled: deviceConnect
Column{
id: column1
width: parent.width
height: parent.height
Image {
id: testImage
fillMode: Image.PreserveAspectFit
anchors.horizontalCenter: parent.horizontalCenter
source: "qrc:/resources/test.png"
height: width
width: parent.height * 3 / 4
}
Label
{
text: qsTr("Test")
font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: "Verdana"
font.bold: deviceConnect
width: parent.width
height: parent.height - testImage.height
color: "#1a1b1d"
}
}
onClicked: enterTest()
}
}
Row {
id: row
x: 40
y: 331
width: 423
height: 40
anchors.bottom: parent.bottom
anchors.horizontalCenterOffset: -159
anchors.bottomMargin: 29
anchors.horizontalCenter: parent.horizontalCenter
rightPadding: 10
leftPadding: 10
padding: 0
spacing: 20
layoutDirection: Qt.LeftToRight
Label {
id: label
height: 40
text: qsTr("Device:")
font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
font.family: "Verdana"
}
ComboBox {
id: comboBox
width: 280
height: 40
currentIndex: -1
textRole: "text"
valueRole: "value"
model: [
{ value: 0, text: "SGX6000" },
{ value: 1, text: "SX666" }
]
onActivated: {
usbHelper.setDevSelect(comboBox.currentValue);
triggerconfig(comboBox.currentValue);
}
Connections{
target: usbHelper
function onNotifyDevInfo(id)
{
comboBox.currentIndex = id;
triggerconfig(comboBox.currentValue);
}
}
}
}
Button {
id: button
x: 193
y: 331
width: 227
height: 40
text: deviceConnect ? "Disconnect" : "Connect"
anchors.bottom: parent.bottom
font.pixelSize: 15
font.bold: true
anchors.horizontalCenterOffset: 244
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 29
font.family: "Verdana"
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: deviceConnect ? "red" : "grey"
radius: 2
}
onClicked: deviceConnect ? triggerDisconnect() : triggerConnect(comboBox.currentValue)
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:400;width:868}
}
##^##*/
C++
1
https://gitee.com/ducksoul/sgxexpress.git
git@gitee.com:ducksoul/sgxexpress.git
ducksoul
sgxexpress
SGXExpress
master

搜索帮助