QString listWidgetStyle = "QProgressBar:vertical"
"{"
"width:8px;"
"background-color:transparent;"
"margin:0px,0px,0px,0px;"
" padding-top:12px; /*上预留位置*/"
" padding-bottom:12px; /*下预留位置*/"
"}"
"QProgressBar::handle:vertical"
" {"
" width:8px;"
" background-color:rgba(255,255,255,0.2);"
" border-radius:4px;"
" min-height:20px;"
" }"
"QProgressBar::handle:vertical:hover"
"{"
" width:9px;"
" background-color:rgba(255,255,255,0.5);"
" border-radius:4px;"
" min-height:20;"
"}"
"QProgressBar::add-line:vertical"
"{"
" height:12px;"
" width:10px;"
" border-image:url(:/selectfile/scroll/3.png);"
" subcontrol-position:bottom;"
"}"
"QProgressBar::sub-line:vertical"
"{"
" height:12px;"
" width:10px;"
" border-image:url(:/selectfile/scroll/1.png);"
" subcontrol-position:top;"
"}"
"QProgressBar::add-line:vertical:hover"
"{"
" height:12px;"
" width:10px;"
" border-image:url(:/selectfile/scroll/4.png);"
" subcontrol-position:bottom;"
" }"
" QProgressBar::sub-line:vertical:hover"
" {"
" height:12px;"
" width:10px;"
" border-image:url(:/selectfile/scroll/2.png);"
" subcontrol-position:top;"
" }"
" QProgressBar::add-page:vertical,"
"QProgressBar::sub-page:vertical"
" {"
" background-color:transparent;"
" border-radius:4px;"
"}";
ui->progressBar->setStyleSheet(listWidgetStyle);
https://www.cnblogs.com/woshizhizhong-tech/p/15231465.html
这个答案挺不错。
我最近也在苦恼同样的问题,https://ask.csdn.net/questions/7628314
你直接在设计界面中添加样式表也不行嘛