【Qt】QLineEdit 修改密码模式及其样式

[toc]

Qt设置为密码模式

参考 QLineEdit::setEchoMode。密码模式总共有两种

  • QLineEdit::Password
  • QLineEdit::PasswordEchoOnEdit

修改样式

QLineEdit 密码样式使用 Unicode 字符表示,
密码样式修改在QLineEdit::Password 、QLineEdit::PasswordEchoOnEdit 有效
Unicode 值查询网址: https://unicode-table.com/cn/search/

1. 默认样式

默认样式是实心圆点 ,Unicode值 9769

2. 自定义样式

参考 Qt 助手 中的提升,搜索 Qt Style Sheets Examples 中关于 QLineEdit 的提示设置即可。

* 的 unicode 编码为 9679。

1
2
3
4
QLineEdit[echoMode="2"] {
lineedit-password-character: 9679;
}


【Qt】QLineEdit 修改密码模式及其样式
https://hodlyounger.github.io/B_Code/Qt/QLineEdit/【Qt】QLineEdit 修改密码显示及其显示样式/
作者
mingming
发布于
2023年10月27日
许可协议