diff options
Diffstat (limited to 'examples/widgets/richtext/textedit/textedit.cpp')
-rw-r--r-- | examples/widgets/richtext/textedit/textedit.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp index 3a1b3321a1..ed91f6e250 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) |