188 lines
3.8 KiB
QML
188 lines
3.8 KiB
QML
import QtQuick 2.6
|
|
import QtQuick.Controls 2.5
|
|
|
|
//导入指令模块,这样就能发指令了
|
|
import CommandMsg 1.0
|
|
|
|
|
|
Rectangle {
|
|
|
|
id:root
|
|
|
|
visible: true
|
|
x:0
|
|
y:0
|
|
border.width: 1
|
|
border.color: "blue"
|
|
color: "white"
|
|
|
|
CommandMsg {//如果用于多个这个块,那么就会发送多次指令
|
|
objectName: 'CommandInterface'
|
|
id: data
|
|
}
|
|
|
|
Rectangle {
|
|
id:armbtn
|
|
x:10
|
|
y:20
|
|
radius: 5
|
|
width: 80
|
|
height: 40
|
|
border.width:1
|
|
color: "lightgreen"
|
|
|
|
Text{
|
|
anchors.centerIn: parent
|
|
text: qsTr("ARM")
|
|
}
|
|
|
|
MouseArea {
|
|
hoverEnabled: true //默认是false
|
|
anchors.fill: parent
|
|
|
|
onEntered: {
|
|
parent.color = "yellow"
|
|
}
|
|
onExited:{
|
|
parent.color = "lightgreen"
|
|
}
|
|
|
|
onPressed: {
|
|
parent.width = parent.width - 4
|
|
parent.height = parent.height - 2
|
|
parent.x = parent.x + 2
|
|
parent.y = parent.y + 1
|
|
parent.border.width = 2
|
|
|
|
}
|
|
onReleased:{
|
|
parent.width = parent.width + 4
|
|
parent.height = parent.height + 2
|
|
parent.x = parent.x - 2
|
|
parent.y = parent.y - 1
|
|
parent.border.width = 1
|
|
}
|
|
|
|
onClicked: {
|
|
data.text = "ARM"
|
|
data.btnclicked_int(0,0,0,0,0,0,0)
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
id: takeoffbtn
|
|
|
|
x:100
|
|
y:20
|
|
radius: 5
|
|
width: 80
|
|
height: 40
|
|
border.width:1
|
|
color: "lightgreen"
|
|
|
|
|
|
|
|
|
|
Text{
|
|
anchors.centerIn: parent
|
|
text: qsTr("TakeOff")
|
|
}
|
|
|
|
MouseArea{
|
|
hoverEnabled: true //默认是false
|
|
anchors.fill: parent
|
|
|
|
onEntered: {
|
|
parent.color = "yellow"
|
|
}
|
|
onExited:{
|
|
parent.color = "lightgreen"
|
|
}
|
|
onPressed: {
|
|
parent.width = parent.width - 4
|
|
parent.height = parent.height - 2
|
|
parent.x = parent.x + 2
|
|
parent.y = parent.y + 1
|
|
parent.border.width = 2
|
|
|
|
}
|
|
onReleased:{
|
|
parent.width = parent.width + 4
|
|
parent.height = parent.height + 2
|
|
parent.x = parent.x - 2
|
|
parent.y = parent.y - 1
|
|
parent.border.width = 1
|
|
}
|
|
|
|
onClicked: {
|
|
data.text = "TakeOff"
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
id: killbtn
|
|
|
|
x:190
|
|
y:20
|
|
radius: 5
|
|
width: 80
|
|
height: 40
|
|
border.width:1
|
|
color: "darkorange"
|
|
|
|
|
|
Text{
|
|
anchors.centerIn: parent
|
|
text: qsTr("Kill")
|
|
}
|
|
|
|
MouseArea{
|
|
hoverEnabled: true //默认是false
|
|
anchors.fill: parent
|
|
|
|
onEntered: {
|
|
parent.color = "yellow"
|
|
}
|
|
onExited:{
|
|
parent.color = "darkorange"
|
|
}
|
|
onPressed: {
|
|
parent.color = "red"
|
|
parent.width = parent.width - 4
|
|
parent.height = parent.height - 2
|
|
parent.x = parent.x + 2
|
|
parent.y = parent.y + 1
|
|
parent.border.width = 2
|
|
|
|
}
|
|
onReleased:{
|
|
parent.width = parent.width + 4
|
|
parent.height = parent.height + 2
|
|
parent.x = parent.x - 2
|
|
parent.y = parent.y - 1
|
|
parent.border.width = 1
|
|
}
|
|
|
|
onClicked: {
|
|
data.text = "Kill"
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|