Discussion:
[Gambas-user] RichText in Gambas
Rolf-Werner Eilert
2017-07-10 21:58:15 UTC
Permalink
Is there an information about the RichText property? I mean, which HTML
tags are accepted etc.?

I could imagine at least Benoit should know where to get information
about it.

In my GridView example, I tried RichText for the cell. Pure font style
tags run well, like bold, italics etc. But I had a problem with center.

<div align=center> results in not showing the text in the cell at all.

Same thing happens if I try GridView1.Data.Alignment = Align.Center and
then give RichText.

When I use simple Text instead, Align.Center will run. But then I cannot
vary the fontstyles anymore...

Any idea how to solve this?

Regards
Rolf
Tobias Boege
2017-07-10 22:24:14 UTC
Permalink
Is there an information about the RichText property? I mean, which HTML tags
are accepted etc.?
GridView is in gb.gui.base (written in Gambas) and you can see that it uses
the Paint class to draw its cells. To draw RichText it uses Paint.DrawRichText().
If you use gb.qt4 as Paint backend you can trace its source code to see that
ultimately rich text is put into a QTextDocument (by setHTML()) and drawn from
there. The supported HTML is then documented over at QT [1].
I could imagine at least Benoit should know where to get information about
it.
In my GridView example, I tried RichText for the cell. Pure font style tags
run well, like bold, italics etc. But I had a problem with center.
<div align=center> results in not showing the text in the cell at all.
Same thing happens if I try GridView1.Data.Alignment = Align.Center and then
give RichText.
When I use simple Text instead, Align.Center will run. But then I cannot
vary the fontstyles anymore...
Any idea how to solve this?
The GridViewData.Alignment seems to be passed to the DrawRichText() call
and, at least in gb.qt4, the rich text drawing routine constructs an
alignment div out of the Alignment parameter, so I don't know what the
problem is. You could try the <center> tag?

Regards,
Tobi

[1] https://doc.qt.io/qt-4.8/richtext-html-subset.html
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
Loading...