Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to add automatic correction on QTextEdit



  • Hello
    I would like to know how to add automatic correction on Qt.I found some websites that explain to me but I am a beginner and I don't t understand how to do it.I'm linking to the site I visited . http: //wiki.qt.io/Spell-Checking-with-Hunspell.There is a lot of error when I complicate.For example #include libraries "hunspell / hunspell.hxx".
    I downloaded the file from this site http://hunspell.github.io/ MySpell dictionnaries. The only file we could download but it does not work.
    Thank you for your help and sorry if I speak a little bad English.



  • @jacky2580
    This post shows someone successfully using your Hunspell with QTextEdit:
    http://www.qtcentre.org/threads/38227-QTextEdit-with-hunspell-spell-checker-and-syntax-highlighter
    There is also:
    https://forum.qt.io/topic/7143/spell-checker

    In your link https://wiki.qt.io/Spell-Checking-with-Hunspell, did you follow the instructions as per:

    You also must adapt a few files before everything works:



  • Thank you for your reply.
    579/5000
    I downloaded from this link what you proposed to me https://www.linux-apps.com/content/show.php/Online+spell+check+editor?content=77339. I am under Qt 5 so I changed QtGui to QtWidgets and also the .pro file header but I find the following error: unicode is not a memeber of QApplication "settingAspellClass-> setWindowTitle (QApplication :: translate (" settingAspellClass "," settingAspell ", 0, QApplication :: UnicodeUTF8));
    label-> setText (QApplication :: translate ("settingAspellClass", "Dictionary:", 0, QApplication :: UnicodeUTF8)); "
    and if I remove this block the applcation starts but there is no correction. What to do ? I also tested the other links without success.



  • @jacky2580
    If you download code from 7/9 years ago, and it was for Qt 4, you are liable to have to do some work to make it compile for Qt 5. I suspect the compilation error you show is to do with that; doing no more than "I changed QtGui to QtWidgets" is probably not enough, I did more than that to move Qt4 code to Qt5.

    The Hunspell at least looks more recent, so that looks a better bet to me.



  • @JonB
    143/5000
    But when I run hunspell he can not find hunspell / hunspell.hxx how to do it? And yet I have included this file in the header of .pro
    QT += core gui widgets

    TARGET = SpellChecker
    TEMPLATE = app

    SOURCES += hunspell/affentry.cxx
    hunspell/affixmgr.cxx
    hunspell/csutil.cxx
    hunspell/dictmgr.cxx
    hunspell/filemgr.cxx
    hunspell/hashmgr.cxx
    hunspell/hunspell.cxx
    hunspell/hunzip.cxx
    hunspell/phonet.cxx
    hunspell/suggestmgr.cxx
    hunspell/utf_info.cxx
    main.cpp
    dialog.cpp
    spellchecker.cpp
    spellcheckdialog.cpp

    HEADERS = hunspell/affentry.hxx
    hunspell/affixmgr.hxx
    hunspell/atypes.hxx
    hunspell/baseaffix.hxx
    hunspell/csutil.hxx
    hunspell/dictmgr.hxx
    hunspell/filemgr.hxx
    hunspell/hashmgr.hxx
    hunspell/htypes.hxx
    hunspell/hunspell.h
    hunspell/hunspell.hxx
    hunspell/hunzip.hxx
    hunspell/langnum.hxx
    hunspell/phonet.hxx
    hunspell/suggestmgr.hxx
    hunspell/w_char.hxx
    dialog.h
    spellchecker.h
    spellcheckdialog.h



  • @jacky2580

    But when I run hunspell

    I presume you mean compile, not run.

    I don't know, maybe the file hunspell/hunspell.hxx does not actually exist there (have you checked?), or it's looking in the wrong place.



  • Thank you for helping me and sorry to answer you so late. I tried everything but I can not do it. I have not abandonded but I will try when I have all the necessary knowledge. Thanks a lot for your help .


Log in to reply