1、前期准备
Label
文本设置、字体设置
text: "登入密码"font.family: "微软雅黑"font.pixelSize: 20
TextField
cursorVisible: trueselectByMouse: true //鼠标选择,输入错误可以全选一次删除selectionColor: "red" //选中时的颜色显示placeholderText: qsTr("请输入登入密码")
echoMode: TextInput.Normal
TextInput.Normal:按原样显示文本。 (默认)TextInput.Password:显示平台相关的密码掩码字符而不是实际字符。TextInput.NoEcho:不显示任何内容。TextInput.PasswordEchoOnEdit:显示编辑时输入的字符,否则与 TextInput.Password 相同。指定文本在 TextInput 中的显示方式。
2、代码
Fjf_Login.qml
import QtQuick 2.0