[Solved] How to change background color of QWebView?

  • Hello everybody!
    I have a problem: i dont know how to change background color of QWebView. I make a small FB2 reader and use this class to show text on screen. And I want at any time change background color. I have overridden paintEvent, used method fill(), but when I set my html text ( setHtml() ), I cant see it. It turns out that the background blocks the text. How should i correct it?

  • If you really want to do it using paintEvent (not the best choice IMO), you have to call QWebView::paintEvent before doing your painting.
    However, I think it would be either better to do the change directly on the website (if possible, i.e. you own the website).
    Otherwise, you might try the QPalette and associated options.

  • Thanks, used QSS.

  • You welcome, please add [Solved] to the title of this thread (by editing the first post). Thanks.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.