[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]] 助手 中的提升,搜索 [[【Qt】文章导读|Qt]] Style Sheets Examples 中关于 QLineEdit 的提示设置即可。

* 的 unicode 编码为 9679。

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