[Qt-creator] help with custom qch

Eike Ziller Eike.Ziller at qt.io
Wed Sep 28 09:42:39 CEST 2016

> On Sep 28, 2016, at 8:41 AM, Mohammad Mirzadeh <mirzadeh at gmail.com> wrote:
> Hi Folks,
> I am trying to build a custom qch for a library that already comes with html docs. I have noticed a weird issue. The doc pages use <body bgcolor="FFFFFF"> tag but when imported in Qt Creator, the background color is rendered as black. I can fix this by changing the tag to <body bgcolor="#FFFFFF">. Obviously I don't want to change lots of html files.
> Quite interestingly Qt Assistant does render the correct background color. Any ideas what might be causing this and how to fix it?

My guess would be that you used Qt Assistant from Qt < 5.6, which still had a QtWebKit based help viewer?
Qt Creator uses QTextBrowser since it is built with Qt >= 5.6 where QtWebKit is no longer available. QTextBrowser is not a full-fledged html renderer (though, hex color values without leading # are actually not part of the standard, are they?).
I mostly see two ways out:

1. Build Qt Creator yourself against a Qt with the QtWebEngine module installed. There is a web engine based backend in Qt Creator, but it is not included by default. Doesn’t really help if you want to distribute your qch to others who did not do that.
2. Pre-process the html files before creating the qch. Shouldn’t be hard to replace bgcolor=“......” by bgcolor=“#......” recursively in all html files with sed or some other tool.

A longer term 3.: Fix QTextBrowser to accept the colors without leading # ;)

Br, Eike

> Thanks,
> Mohammad
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

More information about the Qt-creator mailing list