123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- import QtQuick
- import QtQuick.Controls 2.5
- import QtQuick.Layouts 1.3
- Rectangle {
- id: schedulList
- width: parent.width
- height: parent.height
- color: 'transparent'
- property StackView stack: null
- Component.onCompleted: {
- }
- 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'
- border.width:1
- border.color:"red"
- GridView {
- id: carGrid
- anchors.fill: parent
- cellWidth: 300
- cellHeight: 300
- focus: true
- anchors.leftMargin: 160
- anchors.rightMargin: 160
- anchors.topMargin: 160
- anchors.bottomMargin: 160
- x:100
- model: appModel.car
- /*
- Rectangle {
- width: 350
- height: 350
- radius: 5
- // border.color: mainAppColor
- color: 'transparent'
- }
- */
- delegate: Item {
- required property string name
- required property int uid
- required property string state
- 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
- }
- text: parent.name + stateText(parent.state)
- color: '#eaf4fc'
- font.family: alibaba.name
- font.pointSize: 20
- Timer{
- id: timerRefresh
- interval:1000
- onTriggered: {
- stateText(parent.state)
- }
- }
- }
- MouseArea {
- anchors.fill: parent
-
- 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
- })
- }
- }
- }
- }
- }
-
- }
- }
|