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. [SOLVED] Adding a Dynamic "qMenu" and "qMenuBar" to a QWindow object...

[SOLVED] Adding a Dynamic "qMenu" and "qMenuBar" to a QWindow object...

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 3.0k Views
  • 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.
  • T Offline
    T Offline
    tmason101
    wrote on last edited by
    #1

    Hello,

    I have a QWindow which works well for the OpenGL program I am using. It is declared like so:

    @class QTApp : public QWindow, protected QOpenGLFunctions {

    // Stuff

    };@

    Trouble is now I need to add a qMenu + qMenuBar to this QWindow. I will also need to hide the menu + menubar objects I add when I go full screen.

    Since for qMenu, qMenuBar, and other items you need a parent of some qtWidgets type do I just inherit from another class? And if so can I still have OpenGL?

    Thank you for your time.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      QWindow does not support QMenu. You can implement it yourself.
      Another option is to use QMainWindow with a "window container":http://qt-project.org/doc/qt-5/qwidget.html#createWindowContainer as it's central widget.
      Take a look on Qt5.3.1/Examples/Qt-5.3/widgets/windowcontainer

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tmason101
        wrote on last edited by
        #3

        Thanks; I am looking at this now.

        Perhaps the info is at the link but when you have a QMainWindow is it possible to make the widget INSIDE the QMainWindow full screen?

        That way a person can toggle the widget itself full screen on/off?

        Thanks for all of your time.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          [quote author="tmason101" date="1410820988"]
          Perhaps the info is at the link but when you have a QMainWindow is it possible to make the widget INSIDE the QMainWindow full screen?

          That way a person can toggle the widget itself full screen on/off?[/quote]

          When you change QMainWindow state to a full screen you will need to hide a menu bar, a status bar and a tool bar if you have them.
          When all of that bars are hidden only central widget is visible and it will occupy a whole screen.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tmason101
            wrote on last edited by
            #5

            [quote author="andreyc" date="1410820812"]QWindow does not support QMenu. You can implement it yourself.
            Another option is to use QMainWindow with a "window container":http://qt-project.org/doc/qt-5/qwidget.html#createWindowContainer as it's central widget.
            Take a look on Qt5.3.1/Examples/Qt-5.3/widgets/windowcontainer
            [/quote]

            Thanks, I tried this and it works great. Exactly what I needed.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tmason101
              wrote on last edited by
              #6

              [quote author="andreyc" date="1410821959"][quote author="tmason101" date="1410820988"]
              Perhaps the info is at the link but when you have a QMainWindow is it possible to make the widget INSIDE the QMainWindow full screen?

              That way a person can toggle the widget itself full screen on/off?[/quote]

              When you change QMainWindow state to a full screen you will need to hide a menu bar, a status bar and a tool bar if you have them.
              When all of that bars are hidden only central widget is visible and it will occupy a whole screen.

              [/quote]

              Thanks, will give this a go...

              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