Qt QSS常用样式总结

原:https://blog.csdn.net/qq_33559992/article/details/85331081

QTabWidget

在这里插入图片描述

QTabWidget::pane {
border: none;//无边框
border-top: 3px solid rgb(0, 160, 230);//边款顶部:3px 实线 颜色(0,160,230)
background: transparent;//背景透明
}
QTabWidget::tab-bar {//tab-bar
border: none; //
}
QTabBar::tab {
border: none;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
color: rgb(0, 0, 0);
background: rgb(255, 255, 255, 30);
height: 28px;
min-width: 85px;
margin-right: 5px;
padding-left: 5px;
padding-right: 5px;
}
QTabBar::tab:hover {
background: rgb(0, 0, 255, 40);
}
QTabBar::tab:selected {
color: white;
background: rgb(0, 160, 230);
}
在这里插入图片描述
QSlider::groove:horizontal {
border: none;
height: 6px;
border-radius: 3px;
background: lightgray;
}
QSlider::handle:horizontal {
border: none;
margin: -5px 0px; /* 上下边距和左右边距*/
width: 16px;
height: 16px;
border-radius: 8px;
background: #e83c3c;
border-image: url(:/images/playPbHandle16_White.png);
}
/划过部分/
QSlider::sub-page:horizontal {
background: #e83c3c;
height: 4px;
border-radius: 3px;
}
/未划过部分/
QSlider::add-page:horizontal {
background: lightgray;
height: 4px;
border-radius: 3px;
}
在这里插入图片描述
QSlider::groove:horizontal {
border: 1px solid #bbb;
background: white;
height: 10px;
border-radius: 4px;
}

QSlider::sub-page:horizontal {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #66e, stop: 1 #bbf);
background: qlineargradient(x1: 0, y1: 0.2, x2: 1, y2: 1, stop: 0 #bbf, stop: 1 #55f);
border: 1px solid #777;
height: 10px;
border-radius: 4px;
}

QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 10px;
border-radius: 4px;
}

QSlider::handle:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #eee, stop:1 #ccc);
border: 1px solid #777;
width: 13px;
margin-top: -2px;
margin-bottom: -2px;
border-radius: 4px;
}

QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}

QSlider::sub-page:horizontal:disabled {
background: #bbb;
border-color: #999;
}

QSlider::add-page:horizontal:disabled {
background: #eee;
border-color: #999;
}

QSlider::handle:horizontal:disabled {
background: #eee;
border: 1px solid #aaa;
border-radius: 4px;
}
QTableView
在这里插入图片描述
QTableView QTableCornerButton::section {
color: white;/文字颜色/
background-color: rgb(41, 139, 201);/背景色/
border: 5px solid #418bc9;/边框/
border-radius:0px;/边框圆角/
border-color: rgb(41, 139, 201);/边框颜色/
font: 10px;/字体大小/
padding:0px 0 0 0px;/内边距/
}

QTableView {
background:transparent;/背景透明/
/color: white; /表格内文字颜色/
/
gridline-color: black; /表格内框颜色/
/background-color: rgb(108, 108, 108); /表格内背景色//
/alternate-background-color: rgb(64, 64, 64);
/selection-color: white; /选中区域的文字颜色/
/
selection-background-color: rgb(77, 77, 77); /选中区域的背景色/
/
border: 2px groove gray;
/*border-radius: 0px;
/padding: 2px 4px;/
}

QHeaderView {
color: white;
font: bold 10pt;
background-color: rgb(41, 139, 201);
border: 0px solid rgb(144, 144, 144);
border:0px solid rgb(191,191,191);
border-left-color: rgba(255, 255, 255, 0);
border-top-color: rgba(255, 255, 255, 0);
border-radius:0px;
min-height:29px;
}

QHeaderView::section {
color: white;
background-color:rgb(41, 139, 201);
border: 5px solid #f6f7fa;
border-radius:0px;
border-color:rgb(41, 139, 201);
}
在这里插入图片描述
QWidget#mangeWidget, #listItemWidget, #musicMangeScrollAreaWidget {
background-color: #f5f5f7;
}
QListWidget#musicMangeListWidget {
border: none;
outline: none;
background-color: #f5f5f7;
}
QListWidget#musicMangeListWidget::item {
background-color: #f5f5f7;
border: solid
}
QListWidget#musicMangeListWidget::item:hover {
background-color: #f5f5f7;
}
QListWidget#musicMangeListWidget::item:selected {
background-color: #e6e7ea;
border-left-width: 4px;
border-left-color: #c62f2f;
}
QLabel#boxTitleLabel, #toolboxNameLabel {
color: #696969;
font-family: “Microsoft Yahei”;
font-size: 9pt;
background-color: #f5f5f7;
}
QScrollArea#musicMangeScrollArea {
border: 0px solid;
border-right-width: 1px;
border-right-color: #dcdbdc;
background-color: #f5f5f7;
}
QScrollBar:vertical {
border: none;
background: #f5f5f7;
width: 10px;
margin: 0px 0 0px 0;
}
QScrollBar::handle:vertical {
background: Gainsboro;
min-height: 20px;
border-radius: 5px;
border: none;
}
QScrollBar::add-line:vertical {
border: 0px solid grey;
background: #32CC99;
height: 0px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
border: 0px solid grey;
background: #32CC99;
height: 0px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none;
width: 0px;
height: 0px;
}
QPushButton#playListTitleButton, #openListButton,
#createPLayListButton {
border: none;
}
QPushButton#playListTitleButton {
text-align : left;
color: #696969;
font-family: “Microsoft Yahei”;
font-size: 9pt;
background-color: #f5f5f7;
}
在这里插入图片描述
/* Red Button */
QPushButton#RedButton {
border-radius: 8px;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
font-size: 16px;
margin: 4px 2px;
background-color: white;
color: black;
border: 2px solid #f44336;
}

QPushButton#RedButton:hover {
background-color: #f44336;
color: white;
}

QPushButton#RedButton:pressed {
background-color: #06AD56;
}

红色悬停样式表2
/* Red Button 2 */
QPushButton#RedButton2 {
background-color: #f44336;
border-radius: 8px;
padding: 16px 32px;
text-align: center;
text-decoration: none;
font-size: 16px;
margin: 4px 2px;
color: white;
}

QPushButton#RedButton2:hover {
background-color: white;
border: 2px solid #f44336;
color: black
}

QPushButton#RedButton2:pressed {
background-color: #06AD56;
}
在这里插入图片描述
QCheckBox{
color:#414347;
}
QCheckBox::indicator {
width:16px;
height:16px;
border:1px solid #000000;
}
QCheckBox::indicator:disabled {
width:16px;
height:16px;
border:1px solid #808080;
}
QCheckBox::indicator:checked {
image:url(:/image/unchecked.png);
}

QCheckBox::indicator:checked:disabled{
image:url(:/image/unchecked-dis.png);
}
在这里插入图片描述
QProgressBar{
font:9pt;
border-radius:5px;
text-align:center;
border:1px solid #E8EDF2;
background-color: rgb(255, 255, 255);
border-color: rgb(180, 180, 180);
}
QProgressBar:chunk{
border-radius:5px;
background-color:#1ABC9C;
}

  • 1
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Qt中,可以使用QSSQt Style Sheet)来设置控件的样式QSS是一种样式文本规范,可以通过QApplication::setStyleSheet()方法设置整个应用的样式,或者使用QWidget::setStyleSheet()方法设置某个QWidget及其子类窗体的样式QSS的格式类似于CSS,可以设置控件的背景图片、大小、字体颜色、字体类型、按钮状态变化等属性,用于美化UI界面。通过QSS,可以实现界面和程序的分离,快速切换皮肤,以及快速实现应用程序的外观界面。QSS的优点是简单便捷,可以在不编译运行程序的前提下直观预览一些常用样式的设置效果,方便、直观、快捷地完成对界面的样式风格设置。你可以参考Qt的帮助文档来了解更多关于QSS的用法和示例。\[2\]\[3\] #### 引用[.reference_title] - *1* *3* [Qtqss常用样式总结](https://blog.csdn.net/wangshuping18/article/details/128932269)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [使用Qss设置窗体样式](https://blog.csdn.net/fuhanghang/article/details/124508405)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值