Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding a vertical layout programmatically?

Tags:

c++

qt

I wanted to know if its possible to hide a vertical layout. I currently have a a horizontal layout with two vertical layouts.I wanted to hide one of the vertical layouts(with all its content) on button click. Any suggestions on how I could do that.

like image 983
Rajeshwar Avatar asked Feb 16 '23 18:02

Rajeshwar


1 Answers

As @jmk said, you need to use a QWidget. I'll just add that it's very easy to turn an existing horizontal or vertical layout into a widget from Qt Designer by right-clicking on it and selecting Morph Into->QWidget:

enter image description here

The layout is entirely preserved, but now you can show/hide the layout box because it's an ordinary widget with that layout.

like image 150
sashoalm Avatar answered Feb 27 '23 18:02

sashoalm