Qt所有滚动条的样式
const QString QSS_VerticalScrollBar = "" "QScrollBar:vertical{" //垂直滑块整体 "max-width:8px;" "background:#FFFFFF;" //背景色 "padding-top:0px;" //上预留位置(放置向上箭头) "padding-bottom:0px;" //下预留位置(放置向下箭头) "padding-left:0px;" //左预留位置(美观) "padding-right:0px;" //右预留位置(美观) "border-left:0px solid #d7d7d7;}"//左分割线 "QScrollBar::handle:vertical{"//滑块样式 "background:rgba(196, 84, 13, 1);" //滑块颜色 "border-radius:4px;" //边角圆润 "}" //滑块最大高度max-height:20px; "QScrollBar::handle:vertical:hover{"//鼠标触及滑块样式 "background:rgba(196, 84, 13, 1);}" //滑块颜色 "QScrollBar::add-line:vertical{"//向下箭头样式 "background:url(:/images/resource/images/checkout/down.png) center no-repeat;}" "QScrollBar::sub-line:vertical{"//向上箭头样式 "background:url(:/images/resource/images/checkout/up.png) center no-repeat;}" ""; const QString QSS_HorizentalScrollBar = "" "QScrollBar:horizontal{" "max-height:8px;" "background:#FFFFFF;" "padding-top:0px;" "padding-bottom:0px;" "padding-left:0px;" "padding-right:0px;}" "QScrollBar::handle:horizontal{" "background:rgba(196, 84, 13, 1);" "border-radius:4px;" "}" //min-width:80px; "QScrollBar::handle:horizontal:hover{" "background:rgba(196, 84, 13, 1);}" "QScrollBar::add-line:horizontal{" "background:url(:/images/resource/images/checkout/right.png) center no-repeat;}" "QScrollBar::sub-line:horizontal{" "background:url(:/images/resource/images/checkout/left.png) center no-repeat;}" "";
#include <QScrollBar>
m_listWidget->verticalScrollBar()->setStyleSheet(QSS_VerticalScrollBar);