[Qt-interest] QTextDocument and "\r\n" new-lines
Qt Quest
qt.quest at yahoo.com
Thu Mar 11 08:28:47 CET 2010
Hi all,
Currently, QTextDocument treats "\r\n" as "\n" when setting the document text.
The problem with this behavior is that the Qt would report the next line as starting one character earlier (and line 100: 100 characters earlier). This messes with the indexes which are computed with the file on the hard disk
Also, writing the file again will change the file format from dos to unix.
I tried changing QTextCursor::insertText line 1330:
if (ch == QLatin1Char('\r')
&& (i + 1) < text.length()
&& text.at(i + 1) == QLatin1Char('\n')) {
continue;
//++i;
//ch = text.at(i);
}
which solves the indexes problem, but now the visible-text-symbol-of-newline is shown (like in word processors). Any way to work around it?
Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100310/ec0ea86c/attachment.html
More information about the Qt-interest-old
mailing list