[Qt-creator] SpellChecker: Underline Spelling mistakes

Carel Combrink carel.combrink at gmail.com
Sun Jul 13 21:44:10 CEST 2014

Hi Preeteesh,

I have uploaded the code that I started testing with to my repository, see

To build without the underlining just comment out the #define (plan was to
commit it with it commented out but somehow did not do that. )

Check out my SpellChecker Plugin for Qt Creator @

On Sat, Jul 12, 2014 at 10:20 AM, Carel Combrink <carel.combrink at gmail.com>

> Hi,
> Thanks for the feedback, I am planning to create a release again with the
> latest changes with the release of the next Creator.
> Since I was not getting the desired result I did not push my changes to
> the repository, I will attempt to upload it later today or tomorrow.
> Regards
> -----Original Message-----
> From: preeteesh kakkar
> Sent: 12/07/2014, 9:28 AM
> To: Carel Combrink
> Cc: qt-creator at qt-project.org
> Subject: Re: [Qt-creator] SpellChecker: Underline Spelling mistakes
> Sorry somehow i clicked on Send button a little too early, so can you
> share code which you are using to highlight a text block?
> On Sat, Jul 12, 2014 at 3:26 AM, preeteesh kakkar <
> preeteesh.kakkar at gmail.com> wrote:
>> Hi Carel,
>> This is very kool plugin that I would love to use. I compiled your plugin
>> sources and looked at it, it looks great. I don't see any place in your
>> code where you are using setExtraAdditionalFormats, I tried adding below
>> code which highlighting the line in below function and it does works
>> SpellCheckerCore::addWordsWithSpellingMistakes
>> {
>> .....
>> TextEditor::BaseTextEditorWidget* editorWidget =
>> qobject_cast<TextEditor::BaseTextEditorWidget*>(d->currentEditor->widget());
>>     if (words.count() != 0) {
>>         editorWidget->setHighlightCurrentLine(true);
>>     }
>>     else
>>     {
>>         editorWidget->setHighlightCurrentLine(false);
>>     }
>> .....
>> }
>> On Fri, Jul 11, 2014 at 5:11 PM, Carel Combrink <carel.combrink at gmail.com
>> > wrote:
>>> 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
>>> _______________________________________________
>>> Qt-creator mailing list
>>> Qt-creator at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/qt-creator
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20140713/8f9def5c/attachment.html>

More information about the Qt-creator mailing list