CarPage.qml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import QtQuick
  2. import QtQuick.Controls 2.5
  3. import QtQuick.Layouts 1.3
  4. Rectangle {
  5. id: carForm
  6. width: parent.width
  7. height: parent.height
  8. color: 'transparent'
  9. property StackView stack: null
  10. Component.onCompleted: {
  11. }
  12. Rectangle {
  13. width: parent.width
  14. height: parent.height
  15. anchors.top: parent.top
  16. anchors.horizontalCenter: parent.horizontalCenter
  17. anchors.verticalCenter: parent.verticalCenter
  18. color: 'transparent'
  19. // ListModel {
  20. // id: carList
  21. // ListElement {
  22. // name: "Music"
  23. // icon: "qrc:/images/car1.png"
  24. // }
  25. // ListElement {
  26. // name: "Movies"
  27. // icon: "qrc:/images/car1.png"
  28. // }
  29. // ListElement {
  30. // name: "Camera"
  31. // icon: "qrc:/images/car1.png"
  32. // }
  33. // }
  34. // Rectangle {
  35. // width: 100
  36. // height: 100
  37. // Text {
  38. // text: appModel.city
  39. // }
  40. // }
  41. // Rectangle {
  42. // width: 200
  43. // height: 100
  44. // Text {
  45. // anchors {
  46. // top: myIcon.bottom
  47. // topMargin: 10
  48. // horizontalCenter: parent.horizontalCenter
  49. // }
  50. // text: "test" + 1000004
  51. // color: '#eaf4fc'
  52. // font.family: alibaba.name
  53. // font.pointSize: 20
  54. // }
  55. // // Button {
  56. // // width: 100
  57. // // height: 100
  58. // // }
  59. // MouseArea {
  60. // anchors.fill: parent
  61. // onDoubleClicked: {
  62. // carSelect(1000004)
  63. // }
  64. // }
  65. // }
  66. GridView {
  67. id: carGrid
  68. anchors.fill: parent
  69. cellWidth: 400
  70. cellHeight: 400
  71. focus: true
  72. anchors.leftMargin: 160
  73. anchors.rightMargin: 160
  74. anchors.topMargin: 160
  75. anchors.bottomMargin: 160
  76. model: appModel.car
  77. Rectangle {
  78. width: 350
  79. height: 350
  80. radius: 5
  81. // border.color: mainAppColor
  82. color: 'transparent'
  83. }
  84. delegate: Item {
  85. required property string name
  86. required property int uid
  87. width: 350
  88. height: 350
  89. Image {
  90. id: myIcon
  91. width: 200
  92. height: 200
  93. anchors.horizontalCenter: parent.horizontalCenter
  94. anchors.verticalCenter: parent.verticalCenter
  95. fillMode: Image.PreserveAspectFit
  96. source: 'qrc:/images/car1.png'
  97. }
  98. Text {
  99. anchors {
  100. top: myIcon.bottom
  101. topMargin: 10
  102. horizontalCenter: parent.horizontalCenter
  103. }
  104. text: parent.name + "--" + parent.uid
  105. color: '#eaf4fc'
  106. font.family: alibaba.name
  107. font.pointSize: 20
  108. }
  109. MouseArea {
  110. anchors.fill: parent
  111. // onClicked: parent.GridView.view.currentIndex = parent.uid
  112. onClicked: {
  113. parent.GridView.view.currentIndex = parent.uid
  114. console.log(parent.GridView.view.currentInde)
  115. //carSelect(parent.GridView.view.currentIndex)
  116. page_detail.visible = true
  117. page_detail.stack = stack
  118. stack.push(page_detail, {
  119. "name": parent.name,
  120. "uid": parent.uid
  121. })
  122. }
  123. }
  124. }
  125. }
  126. // CButton {
  127. // id: resultButton
  128. // anchors.top: carGrid.bottom
  129. // anchors.topMargin: 50
  130. // anchors.horizontalCenter: parent.horizontalCenter
  131. // textHeight: 50
  132. // fontHeight: 0.4
  133. // width: 250
  134. // height: 50
  135. // color: pressed ? textClickedColor : mainAppColor
  136. // text: "登 出"
  137. // onClicked: {
  138. // appModel.logout()
  139. // stack.pop()
  140. // }
  141. // }
  142. }
  143. }