How to change "centralWidget" setting?
-
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);
-
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);
@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:
YourcentralWidget
does not have to be one of your widgets. You can add everything to a layout and then apply the layout to the defaultcentralWidget
.
Like I've shown above.
Or you create a newQWidget w
containing your layout and other widgets and then set this widget ascentralWidget
(setCentralWidget(w)
), which adds one more "layer" of steps but is basically the same, since you can access your "new" centralWidget withcentralWidget()
everywhere in yourQMainWindow
class. -
@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:
YourcentralWidget
does not have to be one of your widgets. You can add everything to a layout and then apply the layout to the defaultcentralWidget
.
Like I've shown above.
Or you create a newQWidget w
containing your layout and other widgets and then set this widget ascentralWidget
(setCentralWidget(w)
), which adds one more "layer" of steps but is basically the same, since you can access your "new" centralWidget withcentralWidget()
everywhere in yourQMainWindow
class.@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"...
-
@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"...
@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.