[Interest] formatting bug in QTextEdit
felixover at gmail.com
Wed Aug 27 11:33:28 CEST 2014
i am trying to change the background color of a couple of lines of text,
the position of the block is given in startlinepos and endlinepos. The best
way appears to be to do this via ExtraSelections with the
This works, generally, but the problem is that the last line is not
properly colored completely.
A workaround is to select to the start of the next block, but that fails
when there is no next block.
The problem is probably best visible in the screenshot.
> QTextCharFormat fmt;
> fmt.setProperty(QTextFormat::FullWidthSelection, true);
> QTextCursor c = txt->textCursor();
> c.setPosition(firstlinepos, QTextCursor::MoveAnchor);
> c.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
> c.setPosition(lastlinepos, QTextCursor::KeepAnchor);
> c.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
> sel.cursor = c;
> sel.format = fmt;
> sels << sel;
is this a bug? or do i misunderstand the meaning of "block" and
"fullwidthselection" in this context?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest