[Qt-interest] QWebView: change font ?

Stephen Collyer scollyer at netspinner.co.uk
Fri May 21 16:16:35 CEST 2010


On 21 May 2010 14:29, Stephen Collyer <scollyer at netspinner.co.uk> wrote:

> I have a standalone QWebView object whose font I wish to change
> to a given QFont after it has been created. What is the recommended
> way to do so ?
>
> I'm wondering if I need to create an associated QWebPage and
> QWebSettings ?
>
> --
> Stephen Collyer
>

A little experimentation shows that:

QWebSettings* websettings = QWebSettings::globalSettings();
websettings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize());
websettings->setFontFamily(QWebSettings::StandardFont, font.family());

will dynamically update the font used by QWebView after its creation.
I guess that if you have multiple QWebView object, and you need to control
them separately, then you would have to create separate QWebSettings for
each.

-- 
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100521/8eec9add/attachment.html 


More information about the Qt-interest-old mailing list