I want to make the "Application 1" disappear when the "Single" button is clicked. And show it again i mean both when "Split" button is clicked. Is there any method to make disappear/collapse a widget from QSplitter().
Here's the basic layout :
Thanks in advance.
QWidget
has functions show()
and hide()
, if Application1 is inside QWidget
or any other widget inheriting QWidget
, you can call hide
on the object of that widget when user clicks on Single
button, (widget.hide()
). When user clicks on Split
button you can call show()
on the same object to show the widget.
Edit
Another way of achieving this would be:
to set the size of QSplitter
. When Single
Button is pressed, do the following:
splitter.setSizes([self.width(), 0])
When split
button is pressed do the following:
splitter.setSizes([self.width()/2, self.width()/2])
Assuming that the self
refer to mainWindow containing the splitter and self.width()
gives the width of mainWindow.