PDA

View Full Version : Span style is not working in QTextEdit



joy
2nd April 2007, 15:42
Hi

I have one problem in QTextEdit(4.1.4) class. I want to show a particular text in right align and a particular text in left align. But both texts should display in same line.
In HTML
----------
<p>
<span style="float:right;"> Good Time </span>
<span style="float:left;"> The time is :</span>
</p>

expected result is like :
The time is :................................................. ..........GoodTime
(ignore dots)

The above code is working in browser (IE) as a html file.

I used QTextEdit->append(...qstring.....) in Qt4.1.4. But It won't work.

Help in this regard.

Regards
Joy A

Brandybuck
2nd April 2007, 18:49
Qt's rich text rendering engine is not a W3C compliant HTML renderer. I know that's sad to hear, but it's true. You will be very frustrated if you pretend that it is. For example, it doesn't support the "float" style properties (nor most other CSS properties). See "Supported HTML Subset" in Assistant.

You can do what you want in a <table>, however. Make a two cell table, and align one cell to the left and the other to the right.

joy
3rd April 2007, 13:56
Thanks lot :) .

I suddenly got one reference from Qt-Assistant regarding the table-tr-td
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2006 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.1.4</div></td>
</tr></table>

This is the common line in all the Qt-assistant help page.

Anyway, Thanks for your reply :) .