Draw the mark under a misspelled word instead of Qt. - #346
Open
ilya-fedin wants to merge 1 commit into
Open
Conversation
ilya-fedin
force-pushed
the
spellcheck-mark
branch
from
August 26, 2026 09:18
198c0fc to
e9c9887
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The mark under a misspelled word is drawn by Qt today, and only looks the way it
should because the official builds patch
drawTextItemDecoration()to replaceQTextCharFormat::SpellCheckUnderlinewith the mark Chrome draws. On anunpatched Qt - which is what distribution builds use - the same code gives a
plain wave, and the platform theme has nothing better to offer either: the base
implementation answers
WaveUnderlineand only cocoa overrides it.So the field draws the mark itself now. A range is marked with a new format
property,
InputField::kMisspelledProperty, andpaintMisspelled()walks thevisible blocks, finds those ranges in
QTextLayout::formats()and fills thedescender under them with a tile taken from
QPixmapCache. The tile is the sameone the patch generated - a wave elsewhere, a row of dots on macOS.
One difference from the patch is deliberate: the tile is made for the device
pixel ratio of the widget, while the patch always made it for a ratio of one and
let the painter scale it up. Measured in a field with the default style, against
the patched Qt drawing the same mark:
against 156), because it is rasterized at the resolution of the screen instead
of being stretched from half of it.
Needs desktop-app/lib_spellcheck#35, which marks the ranges with the property
instead of the underline style.