CarPlate.qml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import QtQuick 2.11
  2. import QtQuick.Controls 2.14
  3. Row{
  4. property string paraName
  5. property string plattext: ""
  6. property int paraLength
  7. property alias validator:numField.validator
  8. property alias textFocus:numField.focus
  9. //property alias text:numField.text
  10. property alias inputMethodHints:numField.inputMethodHints
  11. property alias background:bg
  12. spacing: 5
  13. //signal userAccept(var text)
  14. Text {
  15. id: name
  16. anchors.verticalCenter: parent.verticalCenter
  17. text: paraName
  18. color: "#272727"
  19. font.bold: true
  20. font.pixelSize: 13
  21. }
  22. UserComboBox{
  23. id: province
  24. anchors.verticalCenter: parent.verticalCenter
  25. font.pixelSize: 13
  26. width: 50
  27. height:25
  28. bgColor:"#D2D5D9"
  29. model: ListModel{
  30. id: jc
  31. ListElement{ text:"京" }
  32. ListElement{ text:"津" }
  33. ListElement{ text:"沪" }
  34. ListElement{ text:"渝" }
  35. ListElement{ text:"冀" }
  36. ListElement{ text:"豫" }
  37. ListElement{ text:"云" }
  38. ListElement{ text:"辽" }
  39. ListElement{ text:"黑" }
  40. ListElement{ text:"湘" }
  41. ListElement{ text:"皖" }
  42. ListElement{ text:"鲁" }
  43. ListElement{ text:"新" }
  44. ListElement{ text:"苏" }
  45. ListElement{ text:"浙" }
  46. ListElement{ text:"赣" }
  47. ListElement{ text:"鄂" }
  48. ListElement{ text:"桂" }
  49. ListElement{ text:"甘" }
  50. ListElement{ text:"晋" }
  51. ListElement{ text:"蒙" }
  52. ListElement{ text:"陕" }
  53. ListElement{ text:"吉" }
  54. ListElement{ text:"闽" }
  55. ListElement{ text:"贵" }
  56. ListElement{ text:"粤" }
  57. ListElement{ text:"青" }
  58. ListElement{ text:"藏" }
  59. ListElement{ text:"川" }
  60. ListElement{ text:"宁" }
  61. ListElement{ text:"琼" }
  62. ListElement{ text:"港" }
  63. ListElement{ text:"澳" }
  64. ListElement{ text:"台" }
  65. }
  66. Component.onCompleted:{
  67. currentIndex = find("浙")
  68. }
  69. onCurrentTextChanged: {
  70. //root.state = currentText
  71. plattext = currentText+numField.text
  72. }
  73. }
  74. TextField {
  75. id: numField
  76. anchors.verticalCenter: parent.verticalCenter
  77. font.pixelSize: 11
  78. font.bold: false
  79. onTextEdited: {
  80. //userAccept(text)
  81. plattext = province.currentText+text
  82. }
  83. background: Rectangle {
  84. id:bg
  85. implicitWidth: paraLength
  86. height: 25
  87. radius: 4
  88. border.color: "#0099cc"
  89. }
  90. // placeholderText: qsTr("请输入")
  91. }
  92. }