DTextBox.qml 691 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import QtQuick 2.0
  2. Rectangle {
  3. id: root
  4. height: 20
  5. width: 200
  6. radius: 3
  7. color: "#262626"
  8. property string hint: ""
  9. property alias text: _input.text
  10. MouseArea {
  11. anchors.centerIn: root
  12. width: root.width - 10
  13. height: root.height
  14. cursorShape: Qt.IBeamCursor
  15. clip: true
  16. TextInput {
  17. id: _input
  18. anchors.fill: parent
  19. color: "#FFFFFF"
  20. font.pixelSize: root.height * 0.8
  21. selectByMouse: true
  22. selectionColor: "#627FAA"
  23. }
  24. DText {
  25. anchors.verticalCenter: parent.verticalCenter
  26. visible: _input.text == ""
  27. font.pixelSize: root.height * 0.7
  28. text: root.hint
  29. color: "#999999"
  30. }
  31. }
  32. }