From frank at ohufx.com Sat May 14 04:47:40 2016
From: frank at ohufx.com (Frank Rueter | OHUfx)
Date: Sat, 14 May 2016 14:47:40 +1200
Subject: [PySide] override font colour in QWebView
Message-ID: <393ab4ff-fbe7-e680-784e-1e318927cb0a@ohufx.com>
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 = """
v1.4: fixed non-uniform
scale
v1.3: re-implemented the skew parameters
"""
w.setHtml(html)
w.show()
I tried using css on the fly as described here,
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
*vfx for storytellers *
*vfx compositing |
*workflow customisation & consulting
**
*W E L L I N G T O N | N E W Z E A L A N D *
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ohufxLogo_50x50.png
Type: image/png
Size: 2666 bytes
Desc: not available
URL: