PDA

View Full Version : Styling ScrollBar of QWebView via Qt StyleSheets?



chuckshaw
28th May 2008, 19:29
I just replaced a QTextEdit that was used for displaying rudimentary html in my application with a QWebView. My problem is I am unable to style the scrollbar via the QScrollBar tag in my stylesheet. I know that i could technically use the css in the html document myself but thats not what i am looking for. Has anyone attempted to do the same thing?

Note: at the moment I am styling all QScrollBar's at the mainwindow level. So everything has the same look and feel. Except for the QWebView of course. :)

GuS
28th May 2008, 19:58
I am having the same issue here, before i was using QTextBrowser and now the actual WebKit (QWebView) for displaying HTML files of a Documentation module i am working on.

But, seems QWebView does not accept stylesheets...

Cheers.

iridium
6th August 2009, 21:08
Im asking the same question that was asked a yr back, Iam not able to style the QScrollBar component of QWebView, by just adding
QScrollBar:Vertical and QScrollBar::handle parameters.

Is this is a feature not supported, is there anyway to paint the QScrollBar component of QWebView.

GuS
2nd December 2010, 17:55
Hi,

Any tip about this Guys?

Cheers.

Grego
15th December 2010, 23:15
For now you need to hack around it, you can easily change the width as documented here:
http://developer.qt.nokia.com/faq/answer/how_can_i_change_the_width_of_the_scrollbar_of_qwe bview

Note sure if other things besides the width can be easily changed.

papius_vtualetius
25th June 2011, 20:29
Well, you CAN'T do this by Qt Style Sheets, the only way to customize QWebView scroll bars is to use CSS, since WebKit supports scrollbar customization.
See http://www.webkit.org/blog/363/styling-scrollbars/ for examples. This way worked well for me.
You even do not have to have separate image files, you can use base64 encoding in CSS, just like this:

background-image:url(data:image/png;base64,<base64 encoded png image>);

Of course, this works only for your custom web pages, for all others pages you can inject your CSS in theirs code.