Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Hiding the control in a layout and filling it with the other control
thomasjohnaj last edited by
I have to custom widgets which are displayed side by side in a QHBoxLayout as shown in the picture.
In the Widget2 there is a signal attached to a slot which constantly monitors for a variable. if the variable is null then widget2 should not be displayed and widget1 should stretch to the entire area of the layout. as shown in the picture below.
What I have written for the state when the two widgets are displayed
widget1 = new Widget1(this);
widget2 = new Widget2(this);
QHboxLayout* hLayout = new QHboxLayout();
How I can hide this and achieve the state 2 based on the subscribed variable change output?
Pl45m4 last edited by Pl45m4
You mixed the names in your image and in your description text. "Widget1 should stretch", but image label says "widget2" :)
But doesnt matter... it's the same for every widget :)