123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- import QtQuick
- import QtQuick.Controls 2.5
- import QtQuick.Layouts 1.3
- /*
- 自动驾驶车辆选择界面
- */
- Rectangle {
- id: carForm
- width: parent.width
- height: parent.height
- color: 'transparent'
- property StackView stack: null
- Component.onCompleted: {
- }
- //check
- function stateText(value)
- {
- if(value==0) return '(离线)';
- else if(value==1) return '(空闲中)';
- else return '(使用中)';
- }
- Rectangle {
- width: parent.width
- height: parent.height
- anchors.top: parent.top
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- color: 'transparent'
-
- GridView {
- id: carGrid
- anchors.fill: parent
- cellWidth: 300
- cellHeight: 300
- focus: true
- anchors.leftMargin: 150//280+300
- anchors.rightMargin: 160
- anchors.topMargin: 180
- anchors.bottomMargin: 160
- x:100
- model: appModel.car
- /*
- Rectangle {
- width: 350
- height: 350
- radius: 5
- // border.color: mainAppColor
- color: 'transparent'
- }
- */
- //11-15
- delegate: Item {
- required property string name
- required property int uid
- required property string state
- property var uidToNameMap: {
- 1000000: "湛钢B 0533",
- 1000001: "湛钢B 0534",
- 1000002: "湛钢B 0535",
- 1000003: "湛钢B 0537",
- 1000004: "湛钢B 0538"
- }
- width: 300
- height: 300
- Image {
- id: myIcon
- width: 200
- height: 200
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- fillMode: Image.PreserveAspectFit
- source: 'qrc:/images/car1.png'
- }
- Text {
- anchors {
- top: myIcon.bottom
- topMargin: 10
- horizontalCenter: parent.horizontalCenter
- }
- //11-15
- //text: parent.name + stateText(parent.state)
- //color: '#eaf4fc'
- //text: (uidToNameMap[parent.uid]+ stateText(parent.state)) || ""
- text: uidToNameMap[parent.uid] || ""
- color:'#29b6fb'
- font.family: alibaba.name
- font.pointSize: 20
- }
-
- Text {
- anchors {
- top: myIcon.bottom
- topMargin: 50
- horizontalCenter: parent.horizontalCenter
- }
- text: stateText(parent.state)
- color:parent.state==1 ? 'green':'red'
- font.family: alibaba.name
- font.pointSize: 20
- Timer{
- id: timerRefresh
- interval:1000
- onTriggered: {
- stateText(parent.state)
- }
- }
- }
- MouseArea {
- anchors.fill: parent
- enabled:parent.state==1 ? true:false
- onClicked: {
- if(appModel.idle(parent.uid))
- {
- parent.GridView.view.currentIndex = parent.uid
- console.log(parent.GridView.view.currentIndex)
- //carSelect(parent.GridView.view.currentIndex)
- page_detail.visible = true
- page_detail.stack = stack
- page_detail.refresh()
- stack.push(page_detail, {
- "name": parent.name,
- "uid": parent.uid
- })
- }
- }
- }
- }
- }
-
- }
- }
|