Qt代码
Posted 527722032zfl
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Qt代码相关的知识,希望对你有一定的参考价值。
ui->LoginPushButton->setStyleSheet(//正常状态样式
"QPushButton{"
"background-color:rgba(100,25,50,30);"//背景色(也可以设置图片)
"border-style:outset;" //边框样式(inset/outset)
"border-width:4px;" //边框宽度像素
"border-radius:10px;" //边框圆角半径像素
"border-color:rgba(255,255,255,30);" //边框颜色
"font:bold 20px;" //字体,字体大小
"color:rgba(0,0,0,100);" //字体颜色
"padding:6px;" //填衬
"}"
//鼠标按下样式
"QPushButton:pressed{"
"background-color:rgba(1,55,50,20);"
"border-color:rgba(25,25,255,30);"
"border-style:inset;"
"color:rgba(100,0,100,100);"
"}"
//鼠标悬停样式
"QPushButton:hover{"
"background-color:rgba(100,255,100,100);"
//"border-color:rgba(0, 0, 0, 0);"
"color:rgba(0,0,0,200);"
"}");
ui->UserComboBox->setStyleSheet("QComboBox{border:1px solid gray;background: rgba(255, 255, 255, 10);font:20px;height:30px;}"
//"QComboBox {border: 1px solid gray;border-radius: 3px;padding: 1px 2px 1px 2px;background: rgb(46,98,118);height:20px;}"
//"QComboBox:editable{background:red;}"
//"QComboBox QAbstractItemView{border: 0px;outline:0px;selection-background-color: red;height:100px;background: rgb(100,58,80);font:22px;color:white;}"
//"QComboBox QAbstractItemView::item{height:50px;width:200px;}"
//"QComboBox QAbstractItemView::item:selected{background-color: red;}"
"QComboBox::down-arrow{image:url(:/images/icon/arrow.png);}"
"QComboBox::down-arrow:hover {image:url(:/images/icon/arrow.png);}"
"QComboBox::down-arrow:pressed {border-image: url(:/images/icon/arrow.png);}"
"QComboBox::drop-down {subcontrol-origin: padding;subcontrol-position: top right;width: 20px;border-left-width: 1px;border-left-color: darkgray;border-left-style: solid;border-top-right-radius: 3px;border-bottom-right-radius: 3px;}"
//"QComboBox::drop-down{border:0px;}"
);
//ui->PwdLineEdit->setStyleSheet("QLineEdit{background-color: rgb(255, 255, 255);font:20px;}");
ui->PwdLineEdit->setStyleSheet("QLineEdit{background-color:rgba(255,250,255,10);height:25px;}QLineEdit:focus{background-color: rgba(255,255,255,10)}");
connect(ui->LoginPushButton, &QPushButton::clicked, this, &LoginDialog::on_pushButton_clicked);
ui->UserComboBox->setEditable(true);//设置为可编辑状态
//QIcon onlineIcon("icon/test.ico");
QIcon onlineIcon;
ui->UserComboBox->addItem(onlineIcon, "admin"); //添加图片给超级用户
ui->PwdLineEdit->setEchoMode(QLineEdit::Password); //密码设置为*/
以上是关于Qt代码的主要内容,如果未能解决你的问题,请参考以下文章
在 Qt Creator (Fedora Linux) 中进入 Qt 源代码(不是从源代码构建的)