setCentralWidget() for an arbitrary widget
I am newbie. I have a stupid question for example.
In Qt is an example for the serial port (C:\Qt\Qt5.2.0\5.2.0\mingw48_32\examples\serialport\terminal\terminal.pro).
In file mainwindow.cpp there is a line:
This sets the console in sentral window. But I want to add another widget through the designer. How can I bring the console on this widget?
you could use the promote feature
So set a new central widget, add a layout to it.
add a Qwidget as place holder and promote it to a console.
Then when you run, it will be the console.
Promote is sort of like replace at runtime.
Instead of setting console object as centralWidget , you just set simple Qwidget object as a centralWidget and then take one layout(QHboxLayout or QvboxLayout) and add your console object and newly created ui object using designer to that layout and set this layout to Qwidget object which you have set as centalwidget. it will resolve your problem.