Michael_Levin
21st May 2010, 11:11
hi!
i have a QGridLayout which contents for example 3*3 widgets, and let the middle widget be named as 'GL_SL'.
Also i have some button , and when i press it i want to hide all widgets in gridlayout except my main - and the main should be 'maximized' to the size of gridlayout.
hiding:
for i in range(self.gridLayout.count() - 1, -1, -1):
x = self.gridLayout.itemAt(i).widget()
if x.objectName() != 'GL_LS':
x.hide()
self.gridLayout.activate()
self.opengl.adjustSize() ## self.opengl is 'GL_SL'
show:
for i in range(self.gridLayout.count() - 1, -1, -1):
x = self.gridLayout.itemAt(i).widget()
if x.objectName() != 'GL_LS':
x.show()
self.gridLayout.activate()
self.adjustSize()
and that of course isn't right, cause all stuff disappears, but the 'GL_SL' is not maximized, because there are still other widgets in gridlayout, they are only hidden now, but layout.activate and adjustSize can't help to make my center widget 'maximized' in layout.
the way i can solve the problem - add and remove widgets (instead of show and hide)..)
what is the best solution foir my problem?
thank you!
i have a QGridLayout which contents for example 3*3 widgets, and let the middle widget be named as 'GL_SL'.
Also i have some button , and when i press it i want to hide all widgets in gridlayout except my main - and the main should be 'maximized' to the size of gridlayout.
hiding:
for i in range(self.gridLayout.count() - 1, -1, -1):
x = self.gridLayout.itemAt(i).widget()
if x.objectName() != 'GL_LS':
x.hide()
self.gridLayout.activate()
self.opengl.adjustSize() ## self.opengl is 'GL_SL'
show:
for i in range(self.gridLayout.count() - 1, -1, -1):
x = self.gridLayout.itemAt(i).widget()
if x.objectName() != 'GL_LS':
x.show()
self.gridLayout.activate()
self.adjustSize()
and that of course isn't right, cause all stuff disappears, but the 'GL_SL' is not maximized, because there are still other widgets in gridlayout, they are only hidden now, but layout.activate and adjustSize can't help to make my center widget 'maximized' in layout.
the way i can solve the problem - add and remove widgets (instead of show and hide)..)
what is the best solution foir my problem?
thank you!