Results 1 to 3 of 3

Thread: Span style is not working in QTextEdit

  1. #1
    Join Date
    Sep 2006
    Posts
    10
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Span style is not working in QTextEdit

    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

  2. #2
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Span style is not working in QTextEdit

    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.

  3. The following 2 users say thank you to Brandybuck for this useful post:

    joy (3rd April 2007), KalEl (1st March 2017)

  4. #3
    Join Date
    Sep 2006
    Posts
    10
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Span style is not working in QTextEdit

    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 .

  5. The following user says thank you to joy for this useful post:

    KalEl (1st March 2017)

Similar Threads

  1. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.