Unsolved How to set CSS ScrollBar for a ScrollArea?
-
I'm having problems with QScrollArea style. It doesn't apply the style to the QScrollBar within it. I downloaded this CSS from Github.
QScrollBar:vertical{ background:palette(base); border-top-right-radius:2px; border-bottom-right-radius:2px; width:16px; margin:0px; } /*...and so on.*/
-
Try Convert your color value to string first .
QColor color=ui->anotherWidget->palette().base().color(); //convert your QColor to QString QString colorStr="rgb("+ QString::number(color.red()) + ","+ QString::number(color.green()) + ","+ QString::number(color.blue()) +")" ; QString style="QScrollBar:vertical{" "background:"+colorStr+";" "border-top-right-radius:2px;" "border-bottom-right-radius:2px;" "width:16px;" "margin:0px;" "}" "/*...and so on.*/;"; ui->tableWidget->setStyleSheet(style);