Hi all,

I have a QWebView displaying some html that I download from an external site and I need to change the text colour, because the style inherited from the host application renders the html with black text on a dark grey background.

This is my simple test snippet that produces the problem inside the intended host app:

   from PySide import QtWebKit, QtCore

   w = QtWebKit.QWebView() html = """<p>v1.4: fixed non-uniform
   scale</p> <p> <hr /> v1.3: re-implemented the skew parameters</p>
   <hr /> """

   w.setHtml(html)

   w.show()

I tried using css on the fly as described here, <https://deptinfo-ensip.univ-poitiers.fr/ENS/pyside-docs/PySide/QtWebKit/QWebSettings.html#PySide.QtWebKit.PySide.QtWebKit.QWebSettings.setUserStyleSheetUrl> but to no avail:

   # sets backgroudn colour - just to test if it works at all

   css =
   'data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow=='


   w.settings().setUserStyleSheetUrl(css)

I also tried messing with the widgets palette but couldn't get it to work.
I am trying to avoid modifying the html string to include colour instructions but currently that seems to be the easiest option.

Any advice out there?

Cheers,
frank


--
ohufxLogo 50x50 <http://www.ohufx.com>    

*vfx for storytellers <http://www.ohufx.com>*

*vfx compositing <http://ohufx.com/index.php/vfx-compositing> | *workflow customisation & consulting <http://ohufx.com/index.php/vfx-customising>**

*W E L L I N G T O N    |    N E W   Z E A L A N D *

_______________________________________________
PySide mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/pyside

Reply via email to