Fix implementation of spell check underline styles
The QTextCharFormat documentation said that the used style is based on
QStyle::SH_SpellCheckUnderlineStyle style hint, however in fact the
implementation (drawTextItemDecoration in qpainter.cpp) uses
themeHint(QPlatformTheme::SpellCheckUnderlineStyle) instead since Qt 5
(see commit 1f9ae50457
).
Make the documentation match that behavior, and update QPlatformTheme
to use the correct default value.
Also, switch Cocoa theme to use DotLine, as that is what native macOS
applications use.
Change-Id: I2a6bb3da6c7b0686dca87ed2c251b6abc006123c
Task-number: QTBUG-50499
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
This commit is contained in:
parent
c90d9f95d2
commit
88e6f8cff2
@ -531,7 +531,7 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
|
||||
case UiEffects:
|
||||
return QVariant(int(0));
|
||||
case SpellCheckUnderlineStyle:
|
||||
return QVariant(int(QTextCharFormat::SpellCheckUnderline));
|
||||
return QVariant(int(QTextCharFormat::WaveUnderline));
|
||||
case TabFocusBehavior:
|
||||
return QVariant(int(Qt::TabFocusAllControls));
|
||||
case IconPixmapSizes:
|
||||
|
@ -1333,9 +1333,9 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
|
||||
\value DashDotLine Dashs and dots are drawn using Qt::DashDotLine.
|
||||
\value DashDotDotLine Underlines draw drawn using Qt::DashDotDotLine.
|
||||
\value WaveUnderline The text is underlined using a wave shaped line.
|
||||
\value SpellCheckUnderline The underline is drawn depending on the QStyle::SH_SpellCeckUnderlineStyle
|
||||
style hint of the QApplication style. By default this is mapped to
|
||||
WaveUnderline, on \macos it is mapped to DashDotLine.
|
||||
\value SpellCheckUnderline The underline is drawn depending on the SpellCheckUnderlineStyle
|
||||
theme hint of QPlatformTheme. By default this is mapped to
|
||||
WaveUnderline, on \macos it is mapped to DotLine.
|
||||
|
||||
\sa Qt::PenStyle
|
||||
*/
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
#include <QtGui/private/qcoregraphics_p.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <QtGui/qtextformat.h>
|
||||
#include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
|
||||
#include <QtThemeSupport/private/qabstractfileiconengine_p.h>
|
||||
#include <qpa/qplatformdialoghelper.h>
|
||||
@ -344,6 +345,8 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
|
||||
return QVariant(QChar(0x2022));
|
||||
case QPlatformTheme::UiEffects:
|
||||
return QVariant(int(HoverEffect));
|
||||
case QPlatformTheme::SpellCheckUnderlineStyle:
|
||||
return QVariant(int(QTextCharFormat::DotLine));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1840,9 +1840,8 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
|
||||
|
||||
\value SH_UnderlineShortcut Whether shortcuts are underlined.
|
||||
|
||||
\value SH_SpellCheckUnderlineStyle A
|
||||
QTextCharFormat::UnderlineStyle value that specifies the way
|
||||
misspelled words should be underlined.
|
||||
\value SH_SpellCheckUnderlineStyle Obsolete. Use SpellCheckUnderlineStyle
|
||||
hint in QPlatformTheme instead.
|
||||
|
||||
\value SH_SpinBox_AnimateButton Animate a click when up or down is
|
||||
pressed in a spin box.
|
||||
|
Loading…
Reference in New Issue
Block a user