⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

How can I include <qpa/qplatformmenu.h> in Qt5

  • I have a class to inherit QMenu/QMenuPrivate, and compiler tell an error in QtWidgets\private\qmenu_p.h, line64:

    @#include <qpa/qplatformmenu.h>@

    error:qpa/qplatformmenu.h: No such file or directory.

    In Qt4.7 my code is Ok. In Qt5, I found the file is there at "mingw47_32\include\QtGui\5.0.2\QtGui\qpa", but just can't include it. Does someone know about this?

  • Moderators

    you can try add the following line to your PRO file:
    @INCLUDEPATH += <path-to-qt>/qtbase/include/QtGui/5.0.0/QtGui@
    don't know why your compiler doesn't find the include path...

  • To raven-worx :

    Thanks. I added "INCLUDEPATH += C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtGui\5.0.2\QtGui" to PRO file, the error goes out.

    but such like code is bound to my system enviroment, I cant move on to other enviroment.

    QPA seems new to Qt5, and in QtCreator2.7 if you type "#include <QtGui/ ", the auto-completing fuction won't prompt anything about qpa, though folder QtGui/qpa are there.

    I wonder if Qt haven't be prepared for open of QPA classes.

  • add this to PRO file, seems working:
    @QT += gui-private @

Log in to reply