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.
You can't control the visible property, But if you want to make QLabel looks invisible as default, just set the width/height property to 0 .
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. Show activity on this post. Transform QLayout to QWidget first, then you can use QWidget->hide().
Try putting the button you want to hide and unhide in another layout. In that layout along with the button put a spacer. Call Button hide and spacer will take over. Spacer takes over hidden button's space.
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().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With