tags:

views:

371

answers:

1

Hi everyone:

I'm working with several widgets but the solution just won't come out. What I have is a series of buttons in series of QHBoxLayouts. Some buttons are hidden by default, but they will appear when needed. To solve space issues, all buttons have a minimum and maximum size so they always look well packed. Also I have a QTextEdit, visible by default, which is in a QVBoxLayout with the QHBoxLayout that hold the buttons

So the problem is this: When I hide the QTextEdit and show the other buttons, the window won't resize. After searching I found that using self.ui.layout().setSizeConstraint(QtGui.QLayout.SetFixedSize) will do the trick, but the problem is that it takes the maximum size from all widgets, therefore I end a huge window. Doing self.ui.layout().setSizeConstraint(QtGui.QLayout.SetMinAndMaxSize) won't resize the window

I already tried using self.ui.resize(0,0), and when doing a self.ui.layout().update() I got False (which I find odd, http://doc.trolltech.com/4.6/qlayout.html#activate), and also tried to override sizeHint() but it keeps using the max size for all widgets.

Is there a way to resize the window and while taking care of the min and max size of a widget?

Thanks in advance

+1  A: 

The answer was quite lame... Just needed to change the QVBoxLayout for a QGridLayout and use self.ui.layout().setSizeConstraint(QtGui.QLayout.SetFixedSize)

masterLoki
You could accept your answer, so that your question will not show up in "unanswered questions" list.
Denilson Sá