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

My <QtGui> file is not working



  • I think that my <QtGui> file is incomplete or has nothing in it. When I substitute the header file for the many widget classes I need for my project (as per the tutorial instructions), it's supposed to save typing and space in the .cpp file. It will not work. I think that the file is incomplete or has nothing in it.
    This...

    #include <QtGui>

    instead of...

    #include <QWidget>
    #include <QVBoxLayout>
    #include <QHBoxLayout>
    #include <QPushButton>

    Does not work.

    Does anyone have an answer as to how come the <QtGui> header file is not working? Thanks.


  • Moderators

    @TMahoney1979
    try #include <QtWidgets> ;)



  • As raven-worx pointed out, you should include QtWidgets.
    This has been necessary since Qt 5.0
    I suspect you are looking at code/examples or a book based on Qt 4.X.
    If so, you should reference:

    https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5
    

Log in to reply