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 <frederik.gladhorn@qt.io>bb10
parent
f6cca6ab8a
commit
bc74273143
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue