Qt Creator not importing proper GUI files automatically

  • Hello,

    I'm using Qt Creator Qt Creator 4.2.1 with Qt 5.8 x64 (installed using an installer) on Ubuntu 16.10 x64. It seems that when I create a new Dialog (with Add New -> Qt Designer Form Class), it does not import the right file (in the header it imports, "QtGui/QDialog" automatically), so it's strange. The same happens on new project creation with QMainWindow. It seems like removing the "QtGui/" is a valid fix, but why does this happen in the first place? . The .pro does contain the "greaterThan(QT_MAJOR_VERSION, 4): QT += widgets.

    Apprently, this problem does not happen on Windows, but as far as I remember, it didn't use to happen on Ubuntu either, when I first installed Qt. Not sure what happened though. I also tried uninstalling Qt / reinstalling and also using the Qt Creator 4.3 Beta, but the same problem happens.

  • Hi @PhantomR

    I am working under ubuntu 14.04 , and Qt 5.8 (installed using an installer too) and i am not having this problem ,

    the inclulde is :

    #include <QDialog>

    alt text

  • Thank you for your answer @mostefa . I wonder what happened.. I do remember it worked when I first installed Qt. Is there some way to uninstall Qt so that all settings are erased and I can do a fresh install afterwards?

  • Qt Champions 2018

    @PhantomR Do you have Qt 4.8 installed and configured in QtCreator?

  • @jsulm Thank you for your answer. No, I did not install Qt 4.8. Only 5.8 x64 shows up in Qt Creator right now, but previously I've also installed 5.9 beta (right now, only 5.8 is installed since I removed them both and didn't install 5.9 again). I'll try to reinstall Ubuntu today (I've kind of messed it up a while ago anyway), hopefully it'll solve the problem.

  • Update: After reinstalling Ubuntu 17.04 and installing Qt 5.8 x64, the includes no longer seem to be broken.

    Edit: Thank you all for your replies.

Log in to reply

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