Results 1 to 6 of 6

Thread: QTextDocument - line spacing

  1. #1
    Join Date
    Oct 2007
    Location
    Cracow
    Posts
    56
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QTextDocument - line spacing

    Hi, I use QGraphicsTextItem to show QTextDocument by using setDocument function, could you tell how to change line spacing, because i need to decrease it.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTextDocument - line spacing

    You could use setHtml with modified CSS line-height attribute. Or have a look if rtf has a similar option. (Or whatever you have in your QTextDocument. Sorry but my crystal ball is still in repair...)

  3. #3
    Join Date
    Oct 2007
    Location
    Cracow
    Posts
    56
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTextDocument - line spacing

    line-height attribute isn't supported by Qt
    http://doc.trolltech.com/4.5/stylesh...-of-properties
    so I can't do it by this way...

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTextDocument - line spacing

    Jepp, sorry, I was misreading the information under QTextDocument::defaultStyleSheet
    The style sheet needs to be compliant to CSS 2.1 syntax.
    Since only the syntax is meant, you have to go the harder way using QTextLayout yourself. You might want have a look at http://doc.trolltech.com/qq/qq24-textlayouts.html.

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

    mazurekwrc (23rd March 2009)

  6. #5
    Join Date
    Feb 2011
    Posts
    5
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTextDocument - line spacing

    Is there a posibility to adjust the line spacing in the font metrics?
    I use ttf font with Qt 4.5 on a linux system.

    Thanks for help

  7. #6
    Join Date
    Feb 2011
    Posts
    5
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTextDocument - line spacing

    I use QGraphicsTextItem with Qt4.5. As act of desperation I changed font properties of true type font with help of fontforge.

    hhead ascent offset
    hhead descent offset
    hhead line gap

    It works.

Similar Threads

  1. Why is my application's CPU usage always > 50%
    By richardander in forum Qt Programming
    Replies: 10
    Last Post: 14th October 2010, 23:22
  2. QTcpSocket exception.
    By Fastman in forum Qt Programming
    Replies: 9
    Last Post: 29th January 2008, 14:51
  3. Qwizard crashed when created in a slot
    By joshlareau in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2008, 10:16
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 07:13
  5. QTableView paints too much
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2006, 19:42

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.