diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-05-20 23:49:04 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-06-11 14:18:35 +0000 |
commit | eee9d252028c4b3b743c77a406cd6939eda3962f (patch) | |
tree | badceeddc8a36c645faa0e6e9444dae764a0400e /src/gui/text/qtexthtmlparser.cpp | |
parent | 88f5955cb750f2fe3468fe13fef4a11b887315c1 (diff) |
Use CSS classes on html list items for checkbox support
If we replace the bullet character with a UC checkbox character, it
looks ok in a browser, and the HTML parser can recover the BlockMarker
attribute from the css class.
[ChangeLog][QtGui][Text] Checkbox list items can now be read and written
in both HTML and Markdown, including conversions.
Task-number: QTBUG-103714
Change-Id: Ic6b74512075cd4ac16d6f80fdf55b221447491a9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/text/qtexthtmlparser.cpp')
-rw-r--r-- | src/gui/text/qtexthtmlparser.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index a10b880886..ded2dd185a 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1636,6 +1636,14 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) } } break; + case Html_li: + if (key == "class"_L1) { + if (value == "unchecked"_L1) + node->blockFormat.setMarker(QTextBlockFormat::MarkerType::Unchecked); + else if (value == "checked"_L1) + node->blockFormat.setMarker(QTextBlockFormat::MarkerType::Checked); + } + break; case Html_a: if (key == "href"_L1) node->charFormat.setAnchorHref(value); |