QInputContext error in Qt4.8.6: No such File or directory.

  • Hi.
    I have qt 4.7 and I want to run this sample code . I copy all the files and paste in my Ubuntu system . when I run it I saw a lot of error.
    for example in main.cpp i have this error :

    #include <QtGui/QApplication>//no such file or directory
    #include <QtGui/QWidget>//no such file or directory
    app.setInputContext(ic);//error: QApplication does not have method setInputContext

    I decide to create a new application but when I want to create MyInputPanelContext class and write

    #include <QInputContext>

    Said no such file or directory. Where is my problem?

  • Moderators

    Are you sure you're using Qt 4.7?
    As far as I know QInputContext is not part of Qt 5 anymore, so it looks like you're using Qt 5.

  • My Qt creator is 5.4.1
    and my qmake version is 4.8.6 (sorry now I check it again. 4.7 is my old qmake)

  • Moderators

    Check the Kit you're using to build the project ("Tools/Options.../Build & Run/Kits") - which Qt version is set there?

  • in my kit in Auto detected: Desktop qt 5.4.1.Is this mean my qmake is 5.4.1?(so sorry that I did not get it.)
    So how can I change it?
    and How does this application work for qt5?

  • Lifetime Qt Champion


    The first question to answer is: which version of Qt do you want to use ?

    If Qt 4 then go to the Build & Run part of Qt Creator's settings. Then go to Qt Version and add your Qt 4 then and after that make a kit with.

    If you want to use Qt 5 then I'd recommend reading this excellent KDAB blog entry on the subject.

  • @SGaist

    Thanks for reply. Now I understand. (So sorry)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.