Results 1 to 2 of 2

Thread: How to retrieve lines from QTextEdit -- easy way?

  1. #1
    Join Date
    Apr 2007
    Location
    Toruń, POLAND
    Posts
    24
    Thanks
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default How to retrieve lines from QTextEdit -- easy way?

    Hello,

    Let's say I have QTextEdit with one paragraph (block) of text, but since I turned on text wrapping I have several lines (visually).

    Now, how to retrieve line X from QTextEdit? Of course I know, that if I resized QTextEdit the result will be different, but it is not the problem.

    I only came up with idea fiddling with QTextCursor, and going that way to line X, and line X+1 and this way extracting the needed portion of the text. But maybe there is already the easier way.

    have a nice day, bye

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to retrieve lines from QTextEdit -- easy way?

    You'd need to access the document layout of the text edit and fetch the text line at a specified position. But it's probably faster to do it your way.

    (Sorry for bringing up an old thread)

Similar Threads

  1. QTextEdit: how to get lines?
    By claudio in forum Qt Programming
    Replies: 2
    Last Post: 15th July 2007, 21:08
  2. Spaces between lines in QTextEdit
    By troorl_ua in forum Qt Programming
    Replies: 1
    Last Post: 3rd July 2007, 00:06
  3. 'Annotation' of lines in a QTextEdit
    By caduel in forum Qt Programming
    Replies: 21
    Last Post: 23rd June 2007, 15:29
  4. QTextEdit with custom space between lines
    By Lele in forum Qt Programming
    Replies: 4
    Last Post: 22nd November 2006, 08:24
  5. space between lines in QTextEdit
    By Lele in forum Qt Programming
    Replies: 2
    Last Post: 19th September 2006, 13:05

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.