1 QPushbutton
1.1 按钮背景颜色、前景颜色、字体、弧度设置
background-color: rgba(54, 143, 255, 1);
font: 25 9pt "Microsoft YaHei";
color: rgb(255, 255, 255);
border-radius:7px;
1.2 按钮三态样式设置
ui->pushButton->setStyleSheet("QPushButton{background-color: rgb(225, 225, 225);border:2px groove gray;border-radius:50px;padding:2px 4px;border-style: outset;}"
"QPushButton:hover{background-color:rgb(229, 241, 251); color: black;}"
"QPushButton:pressed{background-color:rgb(204, 228, 247);border-style: inset;}");
ui->btn_name->setStyleSheet("QPushButton{background-image: url(:/images/call_up.bmp);}"
"QPushButton:hover{background-image: url(:/images/call_hov.bmp);}"
"QPushButton:pressed{background-image: url(:/images/call_down.bmp);}");
2 QSlider
QSlider::groove:horizontal {
border: 0px solid #bbb;
border-radius: 4px;
}
QSlider::sub-page:horizontal {
background: rgb(218,223,234);
border-radius: 0px;
margin-top: 8px;
margin-bottom: 9px;
}
QSlider::add-page:horizontal {
background: rgb(88,93,105);
border: 0px solid #777;
border-radius: 2px;
margin-top: 8px;
margin-bottom: 9px;
}
QSlider::handle:horizontal {
background: rgb(255,255,255);
border: 1px solid rgba(102,102,102,102);
width: 8px;
height: 8px;
border-radius: 5px;
margin-top: 2px;
margin-bottom: 2px;
}
QSlider::handle:horizontal:hover {
background: rgb(54,143,255);
border: 1px solid rgba(102,102,102,102);
border-radius: 5px;
}
QSlider::sub-page:horizontal:disabled {
background: #bbb;
border-color: #999;
}
QSlider::add-page:horizontal:disabled {
background: rgb(88,93,105);
border-color: #999;
}
QSlider::handle:horizontal:disabled {
background: rgb(88,93,105);
border: 0px solid #aaa;
border-radius: 4px;
}
禁用状态
正常状态
按压状态