TimeDistanceSelector.qml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. import Qt 4.7
  2. Item {
  3. // api
  4. property alias hours: valueHours.displayText
  5. property alias minutes: valueMinutes.displayText
  6. property alias distance: valueDistance.displayText
  7. IntSelector {
  8. height: 20
  9. width: 40
  10. }
  11. // internal
  12. Text {
  13. id: textTime
  14. text: qsTr("Time")
  15. color: heiaLightGrey
  16. font {
  17. family: appItem.applicationFont
  18. pixelSize: appItem.applicationFontSize
  19. }
  20. anchors.left: parent.left
  21. anchors.leftMargin: 15
  22. anchors.top: parent.top
  23. }
  24. BorderImage {
  25. id: inputHours
  26. anchors.top: textTime.bottom
  27. anchors.topMargin: 5
  28. anchors.left: textTime.left
  29. width: 64; height: 48
  30. border { left: 6; top: 6; right: 6; bottom: 6 }
  31. horizontalTileMode: BorderImage.Repeat
  32. verticalTileMode: BorderImage.Repeat
  33. source: "textbox.png"
  34. MouseArea {
  35. anchors.fill: parent
  36. onClicked: valueHours.focus = true;
  37. }
  38. }
  39. TextInput {
  40. id: valueHours
  41. anchors.horizontalCenter: inputHours.horizontalCenter
  42. anchors.verticalCenter: inputHours.verticalCenter
  43. focus: true
  44. cursorVisible: focus
  45. font {
  46. family: appItem.applicationFont
  47. pixelSize: appItem.applicationFontSize
  48. }
  49. inputMask: "09"
  50. text: "0"
  51. KeyNavigation.tab: valueMinutes
  52. }
  53. Text {
  54. id: textHours
  55. text: qsTr("h")
  56. font {
  57. family: appItem.applicationFont
  58. pixelSize: appItem.applicationFontSize
  59. }
  60. anchors.left: inputHours.right
  61. anchors.verticalCenter: inputHours.verticalCenter
  62. color: heiaLightGrey
  63. anchors.leftMargin: 3
  64. }
  65. BorderImage {
  66. id: inputMinutes
  67. anchors.left: textHours.right
  68. anchors.top: inputHours.top
  69. width: 64; height: 48
  70. border { left: 6; top: 6; right: 6; bottom: 6 }
  71. horizontalTileMode: BorderImage.Repeat
  72. verticalTileMode: BorderImage.Repeat
  73. source: "textbox.png"
  74. anchors.leftMargin: 3
  75. MouseArea {
  76. anchors.fill: parent
  77. onClicked: valueMinutes.focus = true;
  78. }
  79. }
  80. TextInput {
  81. id: valueMinutes
  82. anchors.horizontalCenter: inputMinutes.horizontalCenter
  83. anchors.verticalCenter: inputMinutes.verticalCenter
  84. cursorVisible: focus
  85. font {
  86. family: appItem.applicationFont
  87. pixelSize: appItem.applicationFontSize
  88. }
  89. inputMask: "09"
  90. text: "0"
  91. KeyNavigation.tab: valueDistance
  92. }
  93. Text {
  94. id: textMinutes
  95. text: qsTr("min")
  96. font {
  97. family: appItem.applicationFont
  98. pixelSize: appItem.applicationFontSize
  99. }
  100. anchors.left: inputMinutes.right
  101. anchors.verticalCenter: inputMinutes.verticalCenter
  102. color: heiaLightGrey
  103. anchors.leftMargin: 3
  104. }
  105. Text {
  106. id: textDistance
  107. text: qsTr("Distance")
  108. font {
  109. family: appItem.applicationFont
  110. pixelSize: appItem.applicationFontSize
  111. }
  112. anchors.top: inputHours.bottom
  113. anchors.topMargin: 15
  114. anchors.left: textTime.left
  115. color: heiaLightGrey
  116. }
  117. BorderImage {
  118. id: inputDistance
  119. anchors.top: textDistance.bottom
  120. anchors.topMargin: 5
  121. anchors.left: textDistance.left
  122. width: 128; height: 48
  123. border { left: 6; top: 6; right: 6; bottom: 6 }
  124. source: "textbox.png"
  125. MouseArea {
  126. anchors.fill: parent
  127. onClicked: valueDistance.focus = true;
  128. }
  129. }
  130. TextInput {
  131. id: valueDistance
  132. anchors.horizontalCenter: inputDistance.horizontalCenter
  133. anchors.verticalCenter: inputDistance.verticalCenter
  134. cursorVisible: focus
  135. font {
  136. family: appItem.applicationFont
  137. pixelSize: appItem.applicationFontSize
  138. }
  139. inputMask: "000"
  140. text: "0"
  141. KeyNavigation.tab: valueHours
  142. }
  143. Text {
  144. id: textDistanceUnit
  145. text: qsTr("km/miles")
  146. font {
  147. family: appItem.applicationFont
  148. pixelSize: appItem.applicationFontSize
  149. }
  150. anchors.left: inputDistance.right
  151. anchors.verticalCenter: inputDistance.verticalCenter
  152. color: heiaLightGrey
  153. anchors.leftMargin: 3
  154. }
  155. }