[Qt-interest] QPlainTextDocument block separators

John Weeks john at wavemetrics.com
Fri Nov 5 00:17:49 CET 2010


I am using a QTextEdit with QPlainTextDocument. I am using code like this:

	QTextDocument * theDoc = CommandLine->document();
	QTextCursor docCursor(theDoc);
	docCursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
		
	docCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, numChars);
	QString text = docCursor.selectedText();

to extract some text from the QTextEdit, and I need to find out if the selected text crosses over a line end.

By experiment I find that the blocks are separated by QChar::ParagraphSeparator. But I can't find that documented anywhere. Can I count on that into the future?


Using Qt 4.6.3. Soon to upgrade to 4.7...

Regards, John Weeks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101104/42bf0e50/attachment.html 


More information about the Qt-interest-old mailing list