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 to change "centralWidget" setting?
Forum Updated to NodeBB v4.3 + New Features

How to change "centralWidget" setting?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 796 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    I like to gain control of the QMainWindow "central widget" which is now used entirely by text widget - "console".

    I am still not very comfortable changing my main form using BOTH QDesigner and QtCreator.

    Is something like this feasible ?
    In pseudocode - splitting "central widget" - in code
    set entire "central widget" as "mdiArea"
    set top part (size ) as "Tab" widget
    set bottom part (size) as "console"

    I am looking at "dockwidget" - would that work ?

       m_console->setEnabled(false);
        setCentralWidget(m_console);
    
    
    
    Pl45m4P 1 Reply Last reply
    0
    • A Anonymous_Banned275

      I like to gain control of the QMainWindow "central widget" which is now used entirely by text widget - "console".

      I am still not very comfortable changing my main form using BOTH QDesigner and QtCreator.

      Is something like this feasible ?
      In pseudocode - splitting "central widget" - in code
      set entire "central widget" as "mdiArea"
      set top part (size ) as "Tab" widget
      set bottom part (size) as "console"

      I am looking at "dockwidget" - would that work ?

         m_console->setEnabled(false);
          setCentralWidget(m_console);
      
      
      
      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @AnneRanch said in How to change "centralWidget" setting?:

      I am still not very comfortable changing my main form using BOTH QDesigner and QtCreator.

      We've been there...

      Just put your m_console widget in a vertical layout. Then you can add other stuff below.
      When you are finished, you do:

      centralWidget()->setLayout(YourLayout);

      Btw:
      Your centralWidget does not have to be one of your widgets. You can add everything to a layout and then apply the layout to the default centralWidget.
      Like I've shown above.
      Or you create a new QWidget w containing your layout and other widgets and then set this widget as centralWidget (setCentralWidget(w)), which adds one more "layer" of steps but is basically the same, since you can access your "new" centralWidget with centralWidget() everywhere in your QMainWindow class.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      A 1 Reply Last reply
      1
      • Pl45m4P Pl45m4

        @AnneRanch said in How to change "centralWidget" setting?:

        I am still not very comfortable changing my main form using BOTH QDesigner and QtCreator.

        We've been there...

        Just put your m_console widget in a vertical layout. Then you can add other stuff below.
        When you are finished, you do:

        centralWidget()->setLayout(YourLayout);

        Btw:
        Your centralWidget does not have to be one of your widgets. You can add everything to a layout and then apply the layout to the default centralWidget.
        Like I've shown above.
        Or you create a new QWidget w containing your layout and other widgets and then set this widget as centralWidget (setCentralWidget(w)), which adds one more "layer" of steps but is basically the same, since you can access your "new" centralWidget with centralWidget() everywhere in your QMainWindow class.

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        @Pl45m4 Thanks, I prefer "layered" approach.

        It seem that it could be done in constructor or as add to main.cpp.

        I will agree ,the "boundary" between QtDesigner GUI and QtCreator code is a challenge - especially when "the code " is "self documenting"...

        Pl45m4P 1 Reply Last reply
        0
        • A Anonymous_Banned275

          @Pl45m4 Thanks, I prefer "layered" approach.

          It seem that it could be done in constructor or as add to main.cpp.

          I will agree ,the "boundary" between QtDesigner GUI and QtCreator code is a challenge - especially when "the code " is "self documenting"...

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @AnneRanch said in How to change "centralWidget" setting?:

          I will agree ,the "boundary" between QtDesigner GUI and QtCreator code is a challenge - especially when "the code " is "self documenting"

          There is no boundary and the code / Qt is very well documentated.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          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