From 90c683e41cd978b55de57cb424a986db3b637fcc Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 15 May 2019 15:06:20 +0200 Subject: Q(Plain)TextEdit: Observe color hints from style sheet depending on focus state Ask the style sheet style to adapt the palette in WidgetTextControl::getPaintContext() as is done for QLineEdit. Use the palette color in QPlainTextEdit. Change-Id: I67758716b66feaeac8c2433c2a4d3744cd0d5327 Fixes: QTBUG-72100 Reviewed-by: Christian Ehrlicher Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qwidgettextcontrol.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/widgets/widgets/qwidgettextcontrol.cpp') diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 6b8ce63380..ee757bf870 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -64,6 +64,9 @@ #include "private/qtextdocument_p.h" #include "qtextlist.h" #include "private/qwidgettextcontrol_p.h" +#if QT_CONFIG(style_stylesheet) +# include "private/qstylesheetstyle_p.h" +#endif #if QT_CONFIG(graphicsview) #include "qgraphicssceneevent.h" #endif @@ -3187,6 +3190,15 @@ QAbstractTextDocumentLayout::PaintContext QWidgetTextControl::getPaintContext(QW ctx.selections = d->extraSelections; ctx.palette = d->palette; +#if QT_CONFIG(style_stylesheet) + if (widget) { + if (auto cssStyle = qt_styleSheet(widget->style())) { + QStyleOption option; + option.initFrom(widget); + cssStyle->styleSheetPalette(widget, &option, &ctx.palette); + } + } +#endif // style_stylesheet if (d->cursorOn && d->isEnabled) { if (d->hideCursor) ctx.cursorPosition = -1; -- cgit v1.2.3