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. Strange problem with QMenu
Forum Updated to NodeBB v4.3 + New Features

Strange problem with QMenu

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 8.6k Views 2 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.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by A Former User
    #1

    In my main window header I have the following lines:

    @ QMenu *viewMenu;
    QAction *restoreSideBar;@

    In my constructor I have:

    @ viewMenu = menuBar()->addMenu("&View");
    viewMenu->addAction(restoreSideBar);@

    I get the following error message:

    bq. ..\mainwindow.cpp:26: error: invalid use of incomplete type 'struct QMenuBar'

    Am I doing something wrong?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mr-Merlin
      wrote on last edited by
      #2

      Have you missed out #include<QMenuBar> in the cpp?

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        Never mind I fixed the issue. Common logic suggested including QMainWindow should have been enough but I had to include QMenu and QMenuBar manually...

        1 Reply Last reply
        2
        • I Offline
          I Offline
          InnerLight
          wrote on last edited by
          #4

          Thanks a lot, man! It's really fix the problem!

          1 Reply Last reply
          1
          • P Offline
            P Offline
            Pauly
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            1
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Yep
              "incomplete type " is a classic :)

              1 Reply Last reply
              0

              • Login

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