NumberPad.qml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // NumberPad.qml
  2. import QtQuick
  3. import QtQuick.Controls
  4. import QtQuick.Layouts
  5. import Felgo 4.0
  6. Item {
  7. property alias txtPassword: passwd_tf
  8. property alias mlogin: btn_login
  9. width: parent.width*0.3
  10. height: parent.height*0.7
  11. Column {
  12. anchors.centerIn: parent
  13. TextField {
  14. id: passwd_tf
  15. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  16. width: parent.width * 0.95
  17. background: Rectangle {
  18. color: "#e9e9e9"
  19. radius: 5
  20. }
  21. font.pixelSize: 30
  22. echoMode: TextInput.Password
  23. //readOnly: false
  24. horizontalAlignment: Qt.AlignLeft
  25. placeholderText: "请输入密码"
  26. cursorDelegate: Rectangle {
  27. visible: false
  28. }
  29. }
  30. Grid {
  31. id: grid
  32. columns: 3
  33. columnSpacing: -10
  34. rowSpacing: -5
  35. //spacing: 5
  36. Repeater {
  37. model: 10
  38. AppButton {
  39. flat: false
  40. minimumHeight: 50
  41. minimumWidth: 110
  42. text: (index + 1) % 10
  43. fontBold: true
  44. borderColor: app.cardColor
  45. backgroundColor: app.cardColor
  46. textColor: app.fontColor
  47. onClicked: {
  48. console.log("text:",text)
  49. passwd_tf.text += text
  50. }
  51. }
  52. }
  53. AppButton {
  54. minimumHeight: 50
  55. minimumWidth: 110
  56. text: "清空"
  57. textColor: app.fontColor
  58. flat: false
  59. backgroundColor: app.cardColor
  60. borderColor: app.cardColor
  61. onClicked: {
  62. passwd_tf.text = ""
  63. }
  64. }
  65. AppButton {
  66. id: btn_login
  67. minimumHeight: 50
  68. minimumWidth: 110
  69. flat: false
  70. text: "解锁"
  71. textColor: "white"
  72. backgroundColor: "green"
  73. borderColor: "green"
  74. onClicked: {
  75. console.log("解锁")
  76. }
  77. }
  78. }
  79. }
  80. }