Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
4.7.2, 4.7.3, 5.12.0, 5.12.8, 6.7.0
-
None
-
Ubuntu 11.04, Windows
-
-
09ee4282e5eedf5b44245e8b28b223339f87ddfa (qt/qtbase/5.15)
Description
When I use a QSyntaxHighlighter-derived class and call highlighter.rehighlight() in the initialization phase of the program/window, several lines simply vanish in the initial display. One has to resize the window horizontally (presumably to cause a relayout of the text) to show those lines.
This problem was originally reported for the TeXworks project (http://code.google.com/p/texworks/issues/detail?id=469, http://code.google.com/p/texworks/issues/detail?id=497, http://code.google.com/p/texworks/issues/detail?id=505), but I've managed to distill a (minimal) example (see attachment).
The exact manifestation of the problem seems to depend on the Qt version used. So far, I've tested the following ones (the missing lines are for the attached minimal example):
- gcc 4.5.2
- Qt 4.6.3 (debug) works
- Qt 4.7.2 (debug) fails, missing lines: 144—147, 154—157, 160—161, 169—181
- gcc 4.6.0
- Qt 4.7.3 fails, missing lines: 155-157, 160-161, 169-181
I'm not sure if this is also system-dependent?
A few things to note:
- this is independent of the window's initial size, but manual horizontal resize works around the problem
- moving rehighlight() in front of show() apparently solves the problem as well (though this might not be possible in real-life if rehighlight is tied to signals and/or other parts of the code, e.g., for document parsing)
- which lines are missing depends on the highlighting definition (changing ".*$" to ".+$" made lines 137—143 disappear with Qt 4.7.2)
- the cursor disappears when moving to hidden lines with the arrow keys (the real app, TeXworks, crashes, presumably due to the "highlight current line" feature which uses the code from http://doc.qt.nokia.com/latest/widgets-codeeditor.html)
Some additional debugging suggests that the text is properly split into QTextBlocks, but that those are not (all) laid out properly into QTextLines.
I'd be grateful for any insight and would be happy to provide any additional information you might need.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-20354 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
329076,2 | Fix incremental layouting of QTextDocumentLayout | dev | qt/qtbase | Status: NEW | +1 | 0 |
298997,2 | Fix invalid text layout data when a full layout run is interrupted | 5.15 | qt/qtbase | Status: MERGED | +2 | 0 |
329106,3 | Revert "Fix invalid text layout data when a full layout run is interrupted" | dev | qt/qtbase | Status: MERGED | +2 | 0 |
329230,2 | Revert "Fix invalid text layout data when a full layout run is interrupted" | 6.0 | qt/qtbase | Status: MERGED | +2 | 0 |
329231,2 | Revert "Fix invalid text layout data when a full layout run is interrupted" | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |