Qt-interest Archive, October 2007
[QT4] QTextEdit - current line text/number, amount of lines
Message 1 in thread
Hi all,
How can I get current line text from QTextEdit?
Also, How can I get current line number and count of lines in component?
--
[ signature omitted ]
Message 2 in thread
This was discussed a few weeks back in the list. If you can't find it,
send me email
and I'll dig it up.
Alexander D. wrote:
> Hi all,
>
> How can I get current line text from QTextEdit?
> Also, How can I get current line number and count of lines in component?
>
>
--
[ signature omitted ]
Message 3 in thread
On Tue, 09 Oct 2007 10:34:03 -0700
Peter Hackett <peter@xxxxxxxxxxxx> (PH) ÐÐÑÐÐ(Ð):
PH> This was discussed a few weeks back in the list. If you can't find it,
PH> send me email
PH> and I'll dig it up.
PH>
PH> Alexander D. wrote:
PH> > Hi all,
PH> >
PH> > How can I get current line text from QTextEdit?
PH> > Also, How can I get current line number and count of lines in component?
PH> >
PH> >
Oh... try to use QTextCursor and found that it is solution for me. Complete
example below:
---- cut here ----
QTextCursor cursor = fontfileEdit->textCursor();
// Current line text
QString cur_line_text = cursor.block().text().trimmed();
// Current line
int cur_line_number = cursor.blockNumber();
// Current column
int cur_line_column = cursor.columnNumber();
---- cut here ----
But I have one question, this functionality was added in QT 4.2 (as sayed in
documentation), but, how I can realise it on more older QT versions (4.1, 4.0)?
--
[ signature omitted ]