From bc74273143dfb5de8e2255649c7fd037d3d4075a Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 6 Oct 2017 11:07:14 +0200 Subject: QPainter: fix invalid pen style when drawing misspelled words This code asks the platform theme to resolve SpellCheckUnderline to an actual pen style (wave, solid, dash, etc.) but if there's no theme, or if the default implementation in QPlatformTheme is used, the value is still SpellCheckUnderline, which then casted to a PenStyle below in qpainter.cpp: pen.setStyle((Qt::PenStyle)(underlineStyle)); The value 7 is an invalid PenStyle, which leads to random behavior when drawing the underline. Make it WaveUnderline if the platform theme had no opinion on how to draw it. Change-Id: I4f02f9b58f10582cee5aefce7a4d5cd300133140 Reviewed-by: Frederik Gladhorn --- src/gui/painting/qpainter.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/painting/qpainter.cpp') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index b186182c34..49d8fd2846 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -6259,6 +6259,8 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); if (theme) underlineStyle = QTextCharFormat::UnderlineStyle(theme->themeHint(QPlatformTheme::SpellCheckUnderlineStyle).toInt()); + if (underlineStyle == QTextCharFormat::SpellCheckUnderline) // still not resolved + underlineStyle = QTextCharFormat::WaveUnderline; } if (underlineStyle == QTextCharFormat::WaveUnderline) { -- cgit v1.2.3