QLineEdit* lineEdit = new QLineEdit(this);
lineEdit->setContextMenuPolicy(Qt::NoContextMenu);//设置无右键菜单
lineEdit->setPlaceholderText(QString::fromLocal8Bit("密码"));//设置密码提示
lineEdit->setEchoMode(QLineEdit::Password);//设置密码隐藏
lineEdit->setStyleSheet("QLineEdit{border-width:1px;border-radius:4px;font-size:12px;color:black;border:1px solid gray;}"
"QLineEdit:hover{border-width:1px;border-radius:4px;font-size:12px;color:black;border:1px solid rgb(70,200,50);}");
lineEdit->setMaxLength(16);//设置最大长度16位
qt之LineEdit的样式
最新推荐文章于 2023-09-22 15:49:39 发布