[Qt-creator] SpellChecker: Underline Spelling mistakes

preeteesh kakkar preeteesh.kakkar at gmail.com
Sat Jul 12 09:27:47 CEST 2014


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/20140712/67f92c2b/attachment.html>


More information about the Qt-creator mailing list