aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextnodeengine_p.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-05-06 17:43:32 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2021-05-07 19:58:09 +0200
commit1d44ddf57671399a9fa3a7dadab8d448ce7b52e7 (patch)
treeebbf405791fe02eb72695920883ef4a120b46501 /src/quick/items/qquicktextnodeengine_p.h
parenta0f0f4fa54fe8e9fa6526ef6ccde5eb5cbc73450 (diff)
Add support for QTextCharFormat::underlineColor in highlighers and CSS
When a QSyntaxHighlighter calls setUnderlineColor(), TextEdit will use that color for underline, overline and strikeout rendering. Likewise when Text has textFormat: Text.RichText and the HTML contains CSS styling specifying text-decoration-color, it will be applied (depending on the css support in QTextHtmlParser to call setUnderlineColor()). Added a manual test. [ChangeLog][QtQuick][TextEdit] When a QSyntaxHighlighter calls QTextFormat::setUnderlineColor(), or CSS style contains text-decoration-color, Text and TextEdit will now use that color for underline, overline and strikeout rendering. Task-number: QTBUG-87260 Task-number: QTBUG-74572 Task-number: QTBUG-39617 Change-Id: Ia2b564d5366ff67bb5df4f6c9e68ff5773ca5d6a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquicktextnodeengine_p.h')
-rw-r--r--src/quick/items/qquicktextnodeengine_p.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/quick/items/qquicktextnodeengine_p.h b/src/quick/items/qquicktextnodeengine_p.h
index 49c1766045..738b347061 100644
--- a/src/quick/items/qquicktextnodeengine_p.h
+++ b/src/quick/items/qquicktextnodeengine_p.h
@@ -98,7 +98,7 @@ public:
}
BinaryTreeNode(const QGlyphRun &g, SelectionState selState, const QRectF &brect,
- const Decorations &decs, const QColor &c, const QColor &bc,
+ const Decorations &decs, const QColor &c, const QColor &bc, const QColor &dc,
const QPointF &pos, qreal a);
QGlyphRun glyphRun;
@@ -108,6 +108,7 @@ public:
Decorations decorations;
QColor color;
QColor backgroundColor;
+ QColor decorationColor;
QPointF position;
QImage image;
qreal ascent;
@@ -121,7 +122,7 @@ public:
{ insert(binaryTree, BinaryTreeNode(rect, image, selectionState, ascent)); }
static void insert(QVarLengthArray<BinaryTreeNode, 16> *binaryTree, const QGlyphRun &glyphRun, SelectionState selectionState,
- Decorations decorations, const QColor &textColor, const QColor &backgroundColor, const QPointF &position);
+ Decorations decorations, const QColor &textColor, const QColor &backgroundColor, const QColor &underlineColor, const QPointF &position);
static void insert(QVarLengthArray<BinaryTreeNode, 16> *binaryTree, const BinaryTreeNode &binaryTreeNode);
static void inOrder(const QVarLengthArray<BinaryTreeNode, 16> &binaryTree, QVarLengthArray<int> *sortedIndexes, int currentIndex = 0);
};
@@ -186,7 +187,7 @@ public:
void addSelectedGlyphs(const QGlyphRun &glyphRun);
void addUnselectedGlyphs(const QGlyphRun &glyphRun);
void addGlyphsInRange(int rangeStart, int rangeEnd,
- const QColor &color, const QColor &backgroundColor,
+ const QColor &color, const QColor &backgroundColor, const QColor &underlineColor,
int selectionStart, int selectionEnd);
void addGlyphsForRanges(const QVarLengthArray<QTextLayout::FormatRange> &ranges,
int start, int end,
@@ -251,6 +252,7 @@ private:
QColor m_selectionColor;
QColor m_textColor;
QColor m_backgroundColor;
+ QColor m_decorationColor;
QColor m_selectedTextColor;
QColor m_anchorColor;
QPointF m_position;