Results 1 to 13 of 13

Thread: Adding spell checking to lineedits, textedits, ...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Adding spell checking to lineedits, textedits, ...

    Hi,
    exists some qt class which adds spell checking to editable fields like lineedits or textedits; i don't found anything in the documentation. My needs are very poor: a simple mark on the wrong word (not correction feature).

    Thanks
    Giuseppe CalÃ

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Adding spell checking to lineedits, textedits, ...

    You can go with aspell: http://aspell.net/.

  3. #3
    Join Date
    Apr 2008
    Posts
    37
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Adding spell checking to lineedits, textedits, ...

    by any chance do you have any tutorial of how to integrate Aspell to QT QtextEdit???

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Adding spell checking to lineedits, textedits, ...

    Implement a syntax hghlighter that calls ASpell for each word using this API for example: http://aspell.net/man-html/Through-t...ough-the-C-API

  5. #5
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Adding spell checking to lineedits, textedits, ...

    I found this project

    Online spell check editor

    which suit my needs. If needed I can give you some code for help.
    Giuseppe CalÃ

  6. The following user says thank you to jiveaxe for this useful post:

    arturo182 (10th April 2009)

  7. #6
    Join Date
    Apr 2008
    Posts
    37
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Adding spell checking to lineedits, textedits, ...

    Thx, if you can do that I REALLY APPRECIATE!!!

  8. #7
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Adding spell checking to lineedits, textedits, ...

    First list of attachments...
    Attached Files Attached Files
    Giuseppe CalÃ

  9. #8
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Adding spell checking to lineedits, textedits, ...

    Put all these files in your project src dir (see attachment in this and my previous post):

    spelltextedit.h
    spelltextedit.cpp
    highlighter.h
    highlighter.cpp
    Aspell.h
    Aspell.cpp
    ThreadQueue.h
    ThreadQueue.cpp

    Now you can reuse the new widget SpellTextEdit like a normal QTextEdit, just "#include spelltextedit.h".

    This code is different from that in the last version of "Online spell check editor"; this uses aspell instead of hspell; more: the language is hardcoded in highlighter.h so if needed look there.

    Regards
    Attached Files Attached Files
    Giuseppe CalÃ

  10. #9
    Join Date
    Apr 2008
    Posts
    37
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Adding spell checking to lineedits, textedits, ...

    This needs something else from aspell?

  11. #10
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Adding spell checking to lineedits, textedits, ...

    Quote Originally Posted by smarinr View Post
    This needs something else from aspell?
    All you need is aspell program, no libs.

    Bye
    Giuseppe CalÃ

  12. #11
    Join Date
    May 2009
    Posts
    31
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Adding spell checking to lineedits, textedits, ...

    Can you please elaborate how to use these files within project. I want to add spell checking functionality to my QtextEdit.

  13. #12
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Adding spell checking to lineedits, textedits, ...

    Simply use SpellTextEdit instead of QTextEdit (remember to edit highlighter.h for setting your language). Just a little example:

    Qt Code:
    1. #include <QApplication>
    2. #include "spelltextedit.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7. SpellTextEdit *spellTextEdit = new SpellTextEdit;
    8. spellTextEdit->show();
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    Attached are 2 files; use these instead of those in my previous posts;

    Bye
    Attached Files Attached Files
    Giuseppe CalÃ

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.