Can I be sure when iterating over text blocks in QPlainTextEdit that each block is one line exactly? (between /n .. /n)?
Printable View
Can I be sure when iterating over text blocks in QPlainTextEdit that each block is one line exactly? (between /n .. /n)?
As long as I know: yes.
After digging the sources I came to QTextCursor::insertText() which is used by setPlainText() and there it is:Code:
|| ch == QTextBeginningOfFrame || ch == QTextEndOfFrame if (!hasEditBlock) { hasEditBlock = true; d->priv->beginEditBlock(); } if (blockEnd > blockStart) d->priv->insert(d->position, textStart + blockStart, blockEnd - blockStart, formatIdx); d->insertBlock(blockFmt, format); // Here we go: a new block is inserted blockStart = i + 1; }