summaryrefslogtreecommitdiffstats
path: root/examples/widgets/richtext/textedit/textedit.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <[email protected]>2021-05-06 21:13:29 +0200
committerShawn Rutledge <[email protected]>2021-05-07 17:00:20 +0200
commit688602704d5c5226491b0d0ab7f596f9568966d6 (patch)
tree750f50589fe77ebfe214a7a113c7a6d26011d96a /examples/widgets/richtext/textedit/textedit.cpp
parent05f7dd5ead5927ef7b3301380b81d7194d9e0593 (diff)
Support CSS text-decoration-color in underlines, overlines, strikethrough
Also add a feature to the textedit example to set this value. [ChangeLog][QtGui][CSS] The CSS text-decoration-color attribute is now supported in rich text spans with underlines, overlines and strikethrough. Fixes: QTBUG-82114 Task-number: QTBUG-39617 Change-Id: I0065cb5431833da55b0f503ce7ff2b83b74b718a Reviewed-by: Allan Sandfeld Jensen <[email protected]>
Diffstat (limited to 'examples/widgets/richtext/textedit/textedit.cpp')
-rw-r--r--examples/widgets/richtext/textedit/textedit.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp
index 3a1b3321a12..ed91f6e2503 100644
--- a/examples/widgets/richtext/textedit/textedit.cpp
+++ b/examples/widgets/richtext/textedit/textedit.cpp
@@ -354,6 +354,10 @@ void TextEdit::setupTextActions()
actionTextColor = menu->addAction(pix, tr("&Color..."), this, &TextEdit::textColor);
tb->addAction(actionTextColor);
+ const QIcon underlineColorIcon(rsrcPath + "/textundercolor.png");
+ actionUnderlineColor = menu->addAction(underlineColorIcon, tr("Underline color..."), this, &TextEdit::underlineColor);
+ tb->addAction(actionUnderlineColor);
+
menu->addSeparator();
const QIcon checkboxIcon = QIcon::fromTheme("status-checkbox-checked", QIcon(rsrcPath + "/checkbox-checked.png"));
@@ -729,6 +733,17 @@ void TextEdit::textColor()
colorChanged(col);
}
+void TextEdit::underlineColor()
+{
+ QColor col = QColorDialog::getColor(Qt::black, this);
+ if (!col.isValid())
+ return;
+ QTextCharFormat fmt;
+ fmt.setUnderlineColor(col);
+ mergeFormatOnWordOrSelection(fmt);
+ colorChanged(col);
+}
+
void TextEdit::textAlign(QAction *a)
{
if (a == actionAlignLeft)