RFC: spell checking for QTextEdit

Aurélien Gâteau agateau at kde.org
Wed Aug 7 09:13:53 UTC 2013


Hi,

I'd like to reach a decision regarding spell checking for QTextEdit.

It was initially a Qt5 task:

"Allow to register a default syntax highlighter type for QTextEdit, the KDE 
backend would register the spell checking one coming from sonnet as default"

I started working on this task and put together a first patch, but then 
realized it would not be enough: in addition to the syntax highlighter, 
integration with QTextEdit requires context menu support to be able to provide 
suggestions for spelling errors.

I already have code which integrates Sonnet (our spellchecker component) with 
QTextEdit, in the form of a helper class named (for now) 
Sonnet::TextEditInstaller:

https://git.reviewboard.kde.org/r/111912/


There was a discussion on IRC two days ago regarding how transparent should 
spellcheck integration with QTextEdit be, with two possible positions:


A. Find a way to inject spellchecking in all QTextEdit through either QPA or 
our style.

Pros:
- Completely transparent to Qt app developers
- Porting a KDE app to KF5 is only KTextEdit => QTextEdit

Cons:
- Depends on QPA and/or style, so won't always be available depending on the 
platform
- Could cause problems if spellchecking is injected in QTextEdit where it 
makes no sense to provide this feature (eg. code editor)


B. Only provide Sonnet::TextEditInstaller, which app developers would then 
have to explicitly use to add spell checking to QTextEdit in their 
applications.

Pros:
- No under-the-hood hack
- Independant from the platform as long as we have Sonnet plugins for it
- Gives more control to the app developer: for example changing the spelling 
language, adding custom words to ignore, or ignoring blocks of text (think 
quoted email)

Cons:
- Requires developers to explicitly use the API, so porting a KDE app to KF5 
is KTextEdit => QTextEdit + use Sonnet::TextEditInstaller.


I am personnaly in favor of B), but would like to hear others opinions.

Aurélien


More information about the Kde-frameworks-devel mailing list