| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- // NumberPad.qml
- import QtQuick
- import QtQuick.Controls
- import QtQuick.Layouts
- import Felgo 4.0
- Item {
- id: numberPadRoot
- property alias txtPassword: passwd_tf
- property alias mlogin: btn_login
- signal buttonClicked()
- width: parent.width*0.3
- height: parent.height*0.7
- Column {
- anchors.centerIn: parent
- TextField {
- id: passwd_tf
- anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
- width: parent.width * 0.95
- background: Rectangle {
- color: "#e9e9e9"
- radius: 5
- }
- font.pixelSize: 30
- echoMode: TextInput.Password
- //readOnly: false
- horizontalAlignment: Qt.AlignLeft
- placeholderText: "请输入密码"
- cursorDelegate: Rectangle {
- visible: false
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- console.log("TextField clicked!")
- numberPadRoot.buttonClicked()
- }
- }
- }
- Grid {
- id: grid
- columns: 3
- // columnSpacing: -10
- // rowSpacing: -5
- //spacing: 5
- Repeater {
- model: 10
- AppButton {
- flat: false
- minimumHeight: 50
- minimumWidth: 110
- text: (index + 1) % 10
- fontBold: true
- borderColor: app.cardColor
- backgroundColor: app.cardColor
- textColor: app.fontColor
- onClicked: {
- console.log("text:",text)
- passwd_tf.text += text
- numberPadRoot.buttonClicked()
- }
- }
- }
- AppButton {
- minimumHeight: 50
- minimumWidth: 110
- text: "清空"
- textColor: app.fontColor
- flat: false
- backgroundColor: app.cardColor
- borderColor: app.cardColor
- onClicked: {
- passwd_tf.text = ""
- numberPadRoot.buttonClicked()
- }
- }
- AppButton {
- id: btn_login
- minimumHeight: 50
- minimumWidth: 110
- flat: false
- text: "解锁"
- textColor: "white"
- backgroundColor: "green"
- borderColor: "green"
- onClicked: {
- console.log("解锁")
- numberPadRoot.buttonClicked()
- }
- }
- }
- }
- }
|