您当前的位置: 首页 >  qt

txwtech

暂无认证

  • 3浏览

    0关注

    813博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

QT QLineEdit设置密码格式的符号更改*号或者五角星

txwtech 发布时间:2022-08-23 15:20:57 ,浏览量:3

QT QLineEdit设置密码格式的符号更改*号或者五角星

 //-------------------------------------
      //https://bbs.csdn.net/topics/392513644?page=1#post-414289855
      // https://doc.qt.io/archives/qt-4.8/stylesheet-examples.html
      //字符百科查询字符显示对应的HTML代码编号,五角星就是9733,
      https://unicode-table.com/cn/
      //-------------------------------------

 

 

 

#include "mainwindow3_10.h"
#include "ui_mainwindow3_10.h"
#include 

MainWindow3_10::MainWindow3_10(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::MainWindow3_10)
{
    ui->setupUi(this);



      //QString styleSheet=QString("QLineEdit[echoMode=\"2\"]{ lineedit-password-character: 42 }");//*号显示*
     // QString styleSheet=QString("QLineEdit[echoMode=\"2\"]{ lineedit-password-character: 9835 }");//音乐符号显示♫
      QString styleSheet=QString("QLineEdit[echoMode=\"2\"]{ lineedit-password-character: 9733 }");//实心五角星符号显示★

      //-------------------------------------
      //https://bbs.csdn.net/topics/392513644?page=1#post-414289855
      // https://doc.qt.io/archives/qt-4.8/stylesheet-examples.html
      //字符百科查询字符显示对应的HTML代码编号,五角星就是9733,https://unicode-table.com/cn/

      //-------------------------------------

            ui->lineEdit_1->setStyleSheet(styleSheet);
}


MainWindow3_10::~MainWindow3_10()
{
    delete ui;
}


void MainWindow3_10::on_lineEdit_2_returnPressed()//按下回车后执行的操作
{
  //  ui->lineEdit_3->setFocus();
  //  qDebug()text();
   // qDebug()displayText();

}
未设置成功设置失败的原因: 主界面右键-》改变样式表,设置了背景颜色获取其它的内容,将导致设置密码显示的符号失败,会变成默认的小黑点。
关注
打赏
1665060526
查看更多评论
立即登录/注册

微信扫码登录

0.0636s