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] Embedded QMainWindow-deriven widget in application
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Embedded QMainWindow-deriven widget in application

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 3.8k 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.
  • S Offline
    S Offline
    soroush
    wrote on last edited by
    #1

    I would like to have a widget, deriven from QMainWindow in my application. So I can add toolbars, and menus. Or may be somehow add toolbars to my custom widget (derived from any possible class). Toolbars should behave like a mainwindows's toolbar.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      soroush
      wrote on last edited by
      #2

      This image may be more descriptive. See the widget on the right bottom:

      !http://s3.picofile.com/file/7391041826/sc3.png(Imaginary)!

      1 Reply Last reply
      0
      • S Offline
        S Offline
        soroush
        wrote on last edited by
        #3

        Still have no idea about how to implement...

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dbzhang800
          wrote on last edited by
          #4

          I see, you want to embedding a instance of QMainWindow into a normal QWidget. In other words, you don't want to show it as a seperated window.

          So just
          @
          mw->setWindowFlags(mw->windowFlags() & ~Qt::Window);
          @

          Or, You even do not need QMainWindow for such a simple widget contains QMenuBar.

          As QMenuBar, QToolBar and QStatusBar are subclass of QWidget, you can put them to a normal QWidget, the same as you put a QPushButton onto it.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            soroush
            wrote on last edited by
            #5

            [quote author="1+1=2" date="1338136412"]
            Or, You even do not need QMainWindow for such a simple widget contains QMenuBar.

            As QMenuBar, QToolBar and QStatusBar are subclass of QWidget, you can put them to a normal QWidget, the same as you put a QPushButton onto it.
            [/quote]

            Yes, but toolbars won't move around and they will loss their dockablity. Also that small context menu that allows us to choose which toolbar should be show, is no more available.

            First solution looks more convenient but have problems. Size grip is still there. And trying to adjust size of embedded MW will resize whole application :-/

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dbzhang800
              wrote on last edited by
              #6

              I think that "Size grip " will disappear if you didn't create a QStatusBar.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                soroush
                wrote on last edited by
                #7

                Nicely works
                You saved my day, again ;)
                Thanks

                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