Results 1 to 3 of 3

Thread: space between lines in QTextEdit

  1. #1
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default space between lines in QTextEdit

    Hi,
    is there a way to control the space between lines in a QTextEdit Control?
    or some trick for having a larger space using fonts?
    Thanks in advance
    Bye

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: space between lines in QTextEdit

    The only thing I found in the docs is:
    qreal QTextLine::height () const

    Returns the line's height. This is equal to ascent() + descent() + 1.

    See also ascent() and descent().
    But I don't know how you can influence ascent() and descent(), maybe it is a resulting thing from the text layout object params.

    Oh wait a minute, you don't want to change the line hight, but the space between the lines rihgt?
    The look here:
    http://doc.trolltech.com/4.1/qtextlayout.html
    Here's some pseudo code that presents the layout phase:

    int leading = fontMetrics.leading();
    int height = 0;
    qreal widthUsed = 0;
    textLayout.beginLayout();
    while (1) {
    QTextLine line = textLayout.createLine();
    if (!line.isValid())
    break;

    line.setLineWidth(lineWidth);
    height += leading;
    line.setPosition(QPoint(0, height));
    height += line.height();
    widthUsed = qMax(widthUsed, line.naturalTextWidth());
    }
    textLayout.endLayout();

  3. #3
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: space between lines in QTextEdit

    Thanks for the suggestion,
    I'm trying to figure it out how to use it in a QtextEdit
    thanks again
    bye

Similar Threads

  1. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 07:03
  2. linking user space and kernel space programs with qmake
    By zielchri in forum Qt Programming
    Replies: 9
    Last Post: 9th March 2006, 00:11
  3. Painting to QTextEdit
    By gesslar in forum Qt Programming
    Replies: 8
    Last Post: 18th February 2006, 19:40
  4. Obtaining clean (x)html from QTextEdit
    By ccf_h in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2006, 15:47
  5. QTextEdit Justify align making work
    By dec0ding in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2006, 13:02

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.