Hi everyone,
How to change the listview's scrollbar appearance?
I have to change the background and up&down arrow of scrollbar.
Example code will help me a lot. thanks.
Hi everyone,
How to change the listview's scrollbar appearance?
I have to change the background and up&down arrow of scrollbar.
Example code will help me a lot. thanks.
ListView->horizontalScrollBar()->setStyleSheet("QScrollBar:horizontal {border: 2px solid grey;background: #32CC99;height: 15px;margin: 0px 20px 0 20px;}");
Thansk, it works.
But the style is limited to change color, could not support image. The following code do not work as expect.
ui->listView->verticalScrollBar()->setStyleSheet("QScrollBar:vertical {width: 15px; background-image: url(:/img/scroll_bg.png);}; QScrollBar::handle:vertical {image:url(:/img/scroll_handle.png)}");
You cannot support image for the QScrollBar with stylesheet. You can subclass the scrollbar and paint it yourself in the paintevent.
Bookmarks