NumberPad.qml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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: 300
  10. height: 400
  11. MouseArea {
  12. anchors.fill: parent
  13. onClicked: {
  14. console.log("AppPage clicked!")
  15. // 在这里添加处理点击事件的逻辑
  16. //设置屏幕亮度为?
  17. serial.setLightness(128)
  18. loginpage.logintimeout = 0
  19. }
  20. }
  21. ColumnLayout {
  22. anchors.fill: parent
  23. AppTextField {
  24. id: passwd_tf
  25. background: Rectangle {
  26. color: "lightgray"
  27. radius: 5
  28. }
  29. Layout.alignment: Qt.AlignCenter
  30. font.pixelSize: 20
  31. inputMode: inputModePassword
  32. //readOnly: false
  33. horizontalAlignment: Qt.AlignLeft
  34. placeholderText: "请输入密码"
  35. cursorDelegate: Rectangle {
  36. visible: false
  37. }
  38. }
  39. GridLayout {
  40. id: grid
  41. columns: 3
  42. columnSpacing: -5
  43. rowSpacing: -5
  44. //spacing: 5
  45. Repeater {
  46. model: 10
  47. AppButton {
  48. flat: false
  49. width: 50
  50. height: 50
  51. text: (index + 1) % 10
  52. fontBold: true
  53. backgroundColor: "white"
  54. onClicked: {
  55. console.log("text:",text)
  56. passwd_tf.text += text
  57. }
  58. }
  59. }
  60. AppButton {
  61. width: 50
  62. height: 50
  63. text: "清空"
  64. textColor: "black"
  65. flat: false
  66. backgroundColor: "white"
  67. onClicked: {
  68. passwd_tf.text = ""
  69. }
  70. }
  71. AppButton {
  72. id: btn_login
  73. width: 40
  74. height: 40
  75. flat: false
  76. text: "解锁"
  77. textColor: "white"
  78. backgroundColor: "green"
  79. borderColor: "green"
  80. onClicked: {
  81. console.log("解锁")
  82. }
  83. }
  84. }
  85. }
  86. }