How to make a layout invisible in Qt?

I add a layout in a dialog and sometimes I want it and all its containing widgets to hide. How to implement it? I try layout->setEnable(false), but it doesn't seem to work in my tests.

Answers


You can't do that. You should add a widget in your form, put children inside the widget and assign desired layout to the widget. The behavior will be generally the same, but you can use setVisible or hide methods of the widget.


Transform QLayout to QWidget first, then you can use QWidget->hide().


Need Your Help

Exporting classes containing std:: objects (vector, map, etc) from a dll

c++ visual-studio dll

I'm trying to export classes from a DLL that contain objects such as std::vectors and std::strings - the whole class is declared as dll export through: