Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.0
-
None
Description
If in a QTextBlock text passages are highlighted by QSyntaxHighlighter, then QTextLayout.lineCount() returns 0. Under these circumstances no block operations can be implemented which are based on the individual lines of a block (e.g. hyphenation).
// After contentsChange(int, int, int) was triggered. auto lineCount = blockLayout->lineCount(); for (int i = 0; i < lineCount; ++i) { // We'll never get here, if any word in the block is highlighted. :-( auto line = blockLayout->lineAt(i); if (line.isValid()) { // Hyphenation or any other line operation. } }