diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-10-12 11:33:20 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-10-14 20:55:59 +0200 |
commit | eca6bd485436f9ddf16036b98c993b7ffeb7e6c4 (patch) | |
tree | dac540971fa9c6e5e1156846f7d37c0d2607b0f6 /examples | |
parent | d062846cb6e3fc1699b34ea4e108c77e8fc74890 (diff) |
Implement horizontal rule rendering in text
The rule is just a line drawn with the same thickness as an underline:
it gets thicker as DPR increases.
A horizontal rule can be created via <hr/> in RichText.
In markdown it's called a "thematic break," and a line with
- - -
is one way to create it: https://spec.commonmark.org/0.30/#thematic-breaks
<hr width=70/> or <hr width=70%> set the width in pixels, and percent
of the text width, respectively; the rule will be centered within the
line's bounding box in that case, as in QTextEdit etc.
The color can come from QTextFormat::BackgroundBrush if it's set
on the QTextBlockFormat, but otherwise falls back to the text color.
This can be done with CSS styling: <hr style="background-color:green;"/>
[ChangeLog][QtQuick][Text] Horizontal rules (thematic breaks in markdown)
are now rendered as simple horizontal lines, either in the same color
as the text, or as specified via CSS background-color.
Fixes: QTBUG-74342
Task-number: QTBUG-81306
Change-Id: I64f9daf28994225d1a8383d8e2e01e611a0a0237
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quickcontrols2/texteditor/example.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/quickcontrols2/texteditor/example.md b/examples/quickcontrols2/texteditor/example.md index 169ff4338e..0ee17cdb9b 100644 --- a/examples/quickcontrols2/texteditor/example.md +++ b/examples/quickcontrols2/texteditor/example.md @@ -135,6 +135,12 @@ should end with a period or a parenthesis: The list will automatically be renumbered during rendering. +## Thematic Breaks + +A horizontal rule is possible, as in HTML: + +- - - + ## Tables One of the GitHub extensions is support for tables: |