diff options
author | Sami Shalayel <sami.shalayel@qt.io> | 2024-04-09 15:01:25 +0200 |
---|---|---|
committer | Sami Shalayel <sami.shalayel@qt.io> | 2024-04-15 14:46:51 +0200 |
commit | 41a1ff4e3b3b2ebecdd2fe9791981db035964570 (patch) | |
tree | 1d2e648a7c75157d7ae5513898dbe2dedb82a244 /src/quick | |
parent | 9be6a4aaf4f19137a43ad1b8d69f96b1d0d8189b (diff) |
richtext formatting of numbered and bullet lists (<ol> and <ul>)
Set the text color before drawing bullet points for numbered and bullet
point list, instead of using the color of the previous block.
It seems all other calls to addUnselectedGlyphs() are preceded by some
code to set the current color, so do it also for the bullet points.
Extend the manual test for syntaxhighlighter to add the reproducer.
Fixes: QTBUG-111337
Fixes: QTBUG-123855
Fixes: QTBUG-63741
Task-number: QTBUG-57833
Task-number: QTBUG-26612
Task-number: QTBUG-73859
Change-Id: I51a75152416e07c7f84f99b49e2a4b6ca72e78e9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquicktextnodeengine.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 1e437a126d..fd33fa86e2 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -1035,6 +1035,12 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText line.setPosition(QPointF(0, 0)); layout.endLayout(); + // set the color for the bullets, instead of using the previous QTextBlock's color. + if (charFormat.foreground().style() == Qt::NoBrush) + setTextColor(textColor); + else + setTextColor(charFormat.foreground().color()); + QList<QGlyphRun> glyphRuns = layout.glyphRuns(); for (int i=0; i<glyphRuns.size(); ++i) addUnselectedGlyphs(glyphRuns.at(i)); |