Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I include <qpa/qplatformmenu.h> in Qt5
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 7.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    flight9
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      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...

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • F Offline
        F Offline
        flight9
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        1
        • F Offline
          F Offline
          flight9
          wrote on last edited by
          #4

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

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved