InputLine.qml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import QtQuick 2.11
  2. import QtQuick.Controls 2.14
  3. Row{
  4. property string paraName
  5. property int paraLength
  6. property alias validator:textField.validator
  7. property alias textFocus:textField.focus
  8. property alias text:textField.text
  9. property alias inputMethodHints:textField.inputMethodHints
  10. property alias background:bg
  11. spacing: 5
  12. signal userAccept(var text)
  13. Text {
  14. id: name
  15. anchors.verticalCenter: parent.verticalCenter
  16. text: paraName
  17. color: "#272727"
  18. font.bold: true
  19. font.pixelSize: 20
  20. }
  21. TextField {
  22. id: textField
  23. anchors.verticalCenter: parent.verticalCenter
  24. font.pixelSize: 20
  25. font.bold: false
  26. onTextEdited: {
  27. userAccept(text)
  28. }
  29. background: Rectangle {
  30. id:bg
  31. implicitWidth: paraLength
  32. height: 28
  33. radius: 4
  34. border.color: "#0099cc"
  35. }
  36. // placeholderText: qsTr("请输入")
  37. }
  38. }