Results 1 to 4 of 4

Thread: horizontal line / QTextDocument

  1. #1
    Join Date
    Apr 2011
    Posts
    132
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default horizontal line / QTextDocument

    I use QTextDocument for QStyledItemDelegate.

    I need to draw 1px height horizontal line. <hr> does the trick but only width attr is accepted. I need to change its color instead of plain black.
    Below html draws 2px line instead of 1px. I wonder why this is happening.

    Qt Code:
    1. <p style='background:green;font-size:1px;height:1px;line-height:1px;padding:0;margin:0;'>&nbsp</p>
    To copy to clipboard, switch view to plain text mode 

    I tried also filling 1x1px of png image with repeat-x, but looks like repeat-x is ignored and it fill sentire space of the tag which gimme also 2px of height no matter what.

    Looks like also "border" attr is ignored in QTextDocument as well, so cannot use it.

    Any ideas how to it properly ?

    Thanks

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: horizontal line / QTextDocument

    Note, that QTextDocument doesn't have full HTML support. Here is the list of the Supported HTML Subset.
    You might also look at these examples.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. The following user says thank you to spirit for this useful post:

    migel (10th August 2012)

  4. #3
    Join Date
    Apr 2011
    Posts
    132
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: horizontal line / QTextDocument

    I noticed that. I solved that by making an image of 1px width and 2px height. So first top pixel is a color that what I want, second below pixel I made it transparency.

    Qt Code:
    1. <div style='font-size:1px;height:1px;line-height:1px;padding:0;margin:0;background-image: url(:icons/hr.png);background-repeat: repeat-x;'>&nbsp;</div></p>
    To copy to clipboard, switch view to plain text mode 

    So what I see is my 1px height.

  5. #4
    Join Date
    Apr 2011
    Posts
    132
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: horizontal line / QTextDocument

    Looks like background-image does not work for OSX - FFS

Similar Threads

  1. line spaceing in QTextDocument
    By tuli in forum Qt Programming
    Replies: 7
    Last Post: 18th July 2012, 17:24
  2. PyQt, Qwt: Add a horizontal line (y=value)
    By Lykanthropie in forum Qwt
    Replies: 2
    Last Post: 13th January 2012, 08:50
  3. Horizontal line in QTextDocument
    By Ginsengelf in forum Qt Programming
    Replies: 2
    Last Post: 11th February 2011, 09:37
  4. QTextDocument and line height
    By vooft in forum Qt Programming
    Replies: 0
    Last Post: 25th November 2008, 16:47
  5. QTextDocument line number
    By bunjee in forum Qt Programming
    Replies: 14
    Last Post: 10th June 2008, 13:49

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.