PDA

View Full Version : Resizing the dialog boxes



anju123
14th September 2007, 08:36
This problem has been bugging me for a long long time and everytime I find a working solution and moves on but after some time , the same problem again crops up in another dialog and once again I look for some other solution
This is regarding the resizing of the dialog boxes according to the content of the widgets inside it. I got the solution on the same forum i.e use
setSizeConstraint(QLayout::SetFixedSize) but this was not liked by people as this solution does not allow then the user to resize the dialog box manually.
Then I came to a conclusion that the widgets has to be on the main layout and you have to apply some layout to a dialog box and then only the widgets on the dialog will resize

Another time a dialog box with a frame which was having the same problem, now agian back to finding the solution, this time I observed that in the existing file, the minimum size of the Frame was set to some value and as I remove the value and put the minimum size to (0,0) it was working as expected. And offcourse every frame and the dialog box need to have a layout.
Now this is beyond my understanding that how come minimum size can restrict the frame from resizing. So can anyone please help in explaining this weird behaviour otherwise I know that once again another dialog box might come with a different kind of problem for resiziing.
Thanks for reading such a long query :-)

wysota
14th September 2007, 08:52
Could you show us the respective ui file?

anju123
14th September 2007, 09:05
certainly.
The screenshots and the respective UI files

wysota
14th September 2007, 09:24
First of all - why are you using Q3Frame here?

Second of all - why did you use a frame at all? You could have used a layout here.

Third of all - the behaviour you describe is caused by an incorrect use of size policies. The minimumSize has to be 0,0 so that it is ignored (you want to use the sizeHint as the size control mechanism). Then you can adjust size policy of the container you wish to be controled by the size of its contents (in your case the Q3Frame) to alter the behaviour.

Attached is a corrected ui file that simplifies your dialog a bit without changing its final appearance. Note the use of the dialog button box instead of two separate buttons on the bottom.

anju123
14th September 2007, 10:41
wysota,
Thanks for correcting the file
But I have a problem in changing the layout, I am working on the legacy code which was first written in Qt3 and then ported to Qt4
It would be too much of work for me to change the layout of each of the dialogs and also keeping the look and feel same as previous. There are more complicated dialogs then this.
I am still not clear about what you wrote about minimum size and the size hint connectivity , can you elaborate more on that.