QLineEdit 小部件一般用于操作,显示文本的类.是一个单行文本编辑器.
在ui界面中,控件Line Edit 的属性设置echoMode,有4个状态枚举值,如下是摘抄的官方英文文档,并加以翻译.
1.
enum QLineEdit::EchoMode
This enum type describes how a line edit should display its contents.
此枚举类型描述行(hang)编辑器应如何显示内容.
Constant | Value | Description |
QLineEdit::Normal | 0 | Display characters as they are entered. This is the default. 显示输入的字符,这个默认值 |
QLineEdit::NoEcho | 1 | Do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret. 不显示任何东西,这可能使用于连密码长度都要保密的密码. |
QLineEdit::Password | 2 | Display platform-dependent password mask characters instead of the characters actually entered. 显示平台相关的密码掩码字符,而不是实际输入的字符. |
QLineEdit::PasswordEchoOnEdit | 3 | Display characters as they are entered while editing otherwise display characters as with Password. 在编辑时显示输入的字符,否则显示与Password相同的字符 |
See also setEchoMode() and echoMode().
2.
QLineEdit 掩码字符:
值得注意的是,反杠字符\ 将下表中的特殊字符正常显示作用分隔符.分号;@表示用字符@替代显示输入的字符,起到保密的效果.这些掩码不一定说非要记下来,只需要在用到的时候查看会用就行.
字符(必须输入) | 字符(可留空) | 含义 |
A | a | 只能输入A-Z,a-z |
N | n | 只能输入A-Z,a-z,0~9 |
X | x | 可以输入任意字符 |
9 | 0 | 只能输入0-9 |
D | d | 只能输入1-9 |
# | 只能输入+,-,0-9 | |
H | h | 只能输入十六进制字符(0-9,a-f,A-F) |
B | b | 只能输入二进制字符(0,1) |
> | 后面的字母字符自动转换为大写 | |
< | 后面的字母字符自动转换为小写 | |
! | 停止字母字符的大小写转换 | |
\ | 将该表中的特殊字符正常显示用作分隔符 |
今天的碎碎念就到这了~~~