BreatheTable.qml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. import QtQuick 2.11
  2. import QtQuick.Controls 1.4
  3. import QtQuick.Controls 2.14
  4. import "modbus.js" as ModbusJs
  5. Item {
  6. id:root
  7. property alias swipeview:view
  8. property alias positiveTabview:tabview1
  9. property alias negativeTabview:tabview2
  10. property alias capsizeTabview: tabview3
  11. SwipeView {
  12. id: view
  13. property int tableWidth:980
  14. currentIndex: pageIndicator.currentIndex
  15. anchors.fill: parent
  16. clip: true
  17. function dataRandomSet1(modelData,max){
  18. for(var i=0;i<max; i++){
  19. var number= Math.round(Math.random()*30)
  20. var obj={}
  21. obj.pressure=number
  22. modelData.append(obj)
  23. }
  24. }
  25. function dataRandomSet2(modelData,max){
  26. for(var i=0;i<max; i++){
  27. var number= Math.round(Math.random()*(-10))
  28. var obj={}
  29. obj.pressure=number
  30. modelData.append(obj)
  31. }
  32. }
  33. function dataRandomSet3(modelData,max){
  34. for(var i=0;i<max; i++){
  35. var number= Math.round(Math.random()*50)
  36. var obj={}
  37. obj.pressure=number
  38. modelData.append(obj)
  39. }
  40. }
  41. TabView {
  42. id:tabview1
  43. GraphButton{
  44. id:graphButton
  45. x:910
  46. y:-18
  47. z:tabview1.z+1
  48. width: 48
  49. height: 24
  50. onUserClicked: {
  51. var tab = tabview1.getTab(tabview1.currentIndex)
  52. var axisxMax = tab.item.modelData.count
  53. generateCurve.show(0,axisxMax,0,50,tab.item.modelData,tab.title,"横轴时间(秒) 纵轴压力(kPa)")
  54. }
  55. }
  56. Tab {
  57. id:tab
  58. active: true
  59. title: "正压第一次开启"
  60. anchors.fill: parent
  61. anchors.bottomMargin: 5
  62. RecordTable{
  63. // Component.onCompleted: {
  64. // view.dataRandomSet1(modelData,20)
  65. // }
  66. }
  67. }
  68. Tab {
  69. active: true
  70. title: "正压第二次开启"
  71. anchors.fill: parent
  72. anchors.bottomMargin: 5
  73. RecordTable{
  74. // Component.onCompleted: {
  75. // view.dataRandomSet1(modelData,20)
  76. // }
  77. }
  78. }
  79. Tab {
  80. active: true
  81. title: "正压第三次开启"
  82. anchors.fill: parent
  83. anchors.bottomMargin: 5
  84. RecordTable{
  85. // Component.onCompleted: {
  86. // view.dataRandomSet1(modelData,20)
  87. // }
  88. }
  89. }
  90. Tab {
  91. active: true
  92. title: "正压第一次密封"
  93. anchors.fill: parent
  94. anchors.bottomMargin: 5
  95. RecordTable{
  96. // Component.onCompleted: {
  97. // view.dataRandomSet1(modelData,20)
  98. // }
  99. }
  100. }
  101. Tab {
  102. active: true
  103. title: "正压第二次密封"
  104. anchors.fill: parent
  105. anchors.bottomMargin: 5
  106. RecordTable{
  107. // Component.onCompleted: {
  108. // view.dataRandomSet1(modelData,20)
  109. // }
  110. }
  111. }
  112. Tab {
  113. active: true
  114. title: "正压第三次密封"
  115. anchors.fill: parent
  116. anchors.bottomMargin: 5
  117. RecordTable{
  118. // Component.onCompleted: {
  119. // view.dataRandomSet1(modelData,20)
  120. // }
  121. }
  122. }
  123. }
  124. TabView {
  125. id:tabview2
  126. GraphButton{
  127. x:910
  128. y:-18
  129. z:tabview1.z+1
  130. width: 48
  131. height: 24
  132. onUserClicked: {
  133. var tab = tabview2.getTab(tabview2.currentIndex)
  134. var axisxMax = tab.item.modelData.count
  135. generateCurve.show(0,axisxMax,-10,5,tab.item.modelData,tab.title,"横轴时间(秒) 纵轴压力(kPa)")
  136. }
  137. }
  138. Tab {
  139. active: true
  140. title: "负压第一次开启"
  141. anchors.fill: parent
  142. anchors.bottomMargin: 5
  143. RecordTable{
  144. // Component.onCompleted: {
  145. // view.dataRandomSet2(modelData,20)
  146. // }
  147. }
  148. }
  149. Tab {
  150. active: true
  151. title: "负压第二次开启"
  152. anchors.fill: parent
  153. anchors.bottomMargin: 5
  154. RecordTable{
  155. // Component.onCompleted: {
  156. // view.dataRandomSet2(modelData,20)
  157. // }
  158. }
  159. }
  160. Tab {
  161. active: true
  162. title: "负压第三次开启"
  163. anchors.fill: parent
  164. anchors.bottomMargin: 5
  165. RecordTable{
  166. // Component.onCompleted: {
  167. // view.dataRandomSet2(modelData,20)
  168. // }
  169. }
  170. }
  171. Tab {
  172. active: true
  173. title: "负压第一次密封"
  174. anchors.fill: parent
  175. anchors.bottomMargin: 5
  176. RecordTable{
  177. // Component.onCompleted: {
  178. // view.dataRandomSet2(modelData,20)
  179. // }
  180. }
  181. }
  182. Tab {
  183. active: true
  184. title: "负压第二次密封"
  185. anchors.fill: parent
  186. anchors.bottomMargin: 5
  187. RecordTable{
  188. // Component.onCompleted: {
  189. // view.dataRandomSet2(modelData,20)
  190. // }
  191. }
  192. }
  193. Tab {
  194. active: true
  195. title: "负压第三次密封"
  196. anchors.fill: parent
  197. anchors.bottomMargin: 5
  198. RecordTable{
  199. // Component.onCompleted: {
  200. // view.dataRandomSet2(modelData,20)
  201. // }
  202. }
  203. }
  204. }
  205. TabView {
  206. id:tabview3
  207. GraphButton{
  208. x:910
  209. y:-18
  210. z:tabview1.z+1
  211. width: 48
  212. height: 24
  213. onUserClicked: {
  214. var tab = tabview3.getTab(tabview3.currentIndex)
  215. var axisxMax = tab.item.modelData.count
  216. generateCurve.show(0,axisxMax,0,50,tab.item.modelData,tab.title,"横轴时间(秒) 纵轴压力(kPa)")
  217. }
  218. }
  219. Tab {
  220. active: true
  221. title: "倾覆90度记录"
  222. anchors.fill: parent
  223. anchors.bottomMargin: 5
  224. RecordTable{
  225. // Component.onCompleted: {
  226. // view.dataRandomSet3(modelData,20)
  227. // }
  228. }
  229. }
  230. Tab {
  231. active: true
  232. title: "倾覆180度记录"
  233. anchors.fill: parent
  234. anchors.bottomMargin: 5
  235. RecordTable{
  236. // Component.onCompleted: {
  237. // view.dataRandomSet3(modelData,20)
  238. // }
  239. }
  240. }
  241. Tab {
  242. active: true
  243. title: "倾覆270度记录"
  244. anchors.fill: parent
  245. anchors.bottomMargin: 5
  246. RecordTable{
  247. // Component.onCompleted: {
  248. // view.dataRandomSet3(modelData,20)
  249. // }
  250. }
  251. }
  252. }
  253. }
  254. PageIndicator {
  255. id: pageIndicator
  256. interactive: true
  257. count: view.count
  258. currentIndex: view.currentIndex
  259. anchors.bottom: parent.bottom
  260. anchors.horizontalCenter: parent.horizontalCenter
  261. }
  262. }