[Qt-creator] SpellChecker: Underline Spelling mistakes

Carel Combrink carel.combrink at gmail.com
Fri Jul 11 23:11:45 CEST 2014


Hi,

I am busy with a SpellChecker Plugin
<https://github.com/CJCombrink/SpellChecker-Plugin> for Qt Creator but have
one big outstanding thing I want to achieve next. I want to underline the
spelling mistakes in the current file (the red wave-underline).

>From what I understand the TextEditor::SyntaxHighlighter on the document is
responsible for doing the highlighting. Also on the CppDocument there is
already a SyntaxHighlighter (CppHighlighter) that I do not want to replace
nor re-implement (its working rather well as-is).

I am using the setExtraAdditionalFormats() function on the highlighter I
obtain from the BaseTextEditor to try and add just the red underline to the
word with the spelling mistake. This works on some level. Each time the
current file changes I can see the red line appear and disappear from the
misspelled words. I am assuming that as soon as I add the formatting
something else overwrites it, thus removing my added format. If I then
switch to another editor and back my red lines appear again and stay there
until the file is edited again. This causes the red underline again to
 appear and disappear.

Am I doing something wrong, is this a bug or feature?

I would really like to only add the formatting without having to worry
about something overwriting it after I have added it. I understand that at
some point it should be cleared if the word is not a spelling mistake
anymore, but not sure how this will be achieved.

Any help in this regard will be much appreciated.

A screenshot is attached to show what I get if I change editors to keep the
line.

Regards,
---
Check out my SpellChecker Plugin for Qt Creator @
https://github.com/CJCombrink/SpellChecker-Plugin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20140711/9dc85ab7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SpellChecker_Example.png
Type: image/png
Size: 139162 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20140711/9dc85ab7/attachment.png>


More information about the Qt-creator mailing list