PDA

View Full Version : How to retrieve lines from QTextEdit -- easy way?



macias
22nd July 2007, 19:44
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

wysota
14th November 2007, 15:44
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)