Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide completely a QGridLayout?

Tags:

c++

qt

I have a button followed by a QGridLayout full of widgets. I want to show/hide QGridLayout at every button click, but reading documentation of QGridLayout I see there's no show()/hide() implementation, also no setVisible() method available.

How do I achieve this?

like image 380
Pherrymason Avatar asked Mar 03 '10 10:03

Pherrymason


1 Answers

Layouts only affect the size/position of the widgets added to them - for visibility (and anything else - event handling, focus, enable+disable) you care about the parent widget, as mentioned above. QLayout::parentWidget() gives you the widget which owns the layout, which you can then show and hide.

like image 82
James Turner Avatar answered Oct 20 '22 03:10

James Turner