PDA

View Full Version : QDialog resize



rajeshs
5th March 2008, 03:34
Hi all,

I have created one dailag using QDialog , while resizing using mouse only dialog is getting resized.

I want my all dialog elements( I have some lineedit label and listctrl in my dialog ) also

getting resized when resize using mouse , how to achieve this, is there any layouts

available for this ?

wysota
5th March 2008, 05:08
Yes, you need to apply a layout on the dialog object itself.

rajeshs
5th March 2008, 06:51
sorry , which layout can i use , please explain me?

wysota
5th March 2008, 06:53
Whichever one you want. All subclasses of QLayout are for you to use.

rajeshs
5th March 2008, 06:59
i am using designer to desing dialog , i have applied horizontal layout , still only my dialog is expanding not all other objects, is there any other properties we need to set for QDialog ?

wysota
5th March 2008, 07:05
Did you apply a layout to the form itself? You do this by clicking on the form outside any child widgets and then clicking on one of the layout icons. All widgets should then snap in place and resizing the form should cause all child widgets to be resized as well.

rajeshs
12th March 2008, 07:33
If I apply Layout my controls positions and dialog size is increased , how to apply Layout without losing dialog size and controls positions.

wysota
12th March 2008, 07:37
Layouts can be nested. You can also add spacers and set size policies of widgets. All that together should allow you to obtain positioning you need.

rajeshs
12th March 2008, 08:50
can u explain wich layout can we use with spacers?

wysota
12th March 2008, 09:01
Any layout can be used with spacers. Insert a spacer on the form in the desired position and wrap it into a layout together with the widgets.

jpn
12th March 2008, 11:26
I'd recommend reading: Layout Classes (http://doc.trolltech.com/4.3/layout.html)

rajeshs
12th March 2008, 12:30
i used Layouts , itried vertical , horizantal and grid layouts,

in vertivcal layout In runtime if i resize my dialog horizontally its not expanding controls width,

in horizontall layout if i resize my dialiog vertically its not expoanding contols height

If i resize my form my controls height and width should be resized accordingly , how to achieve this ?

jpn
12th March 2008, 12:35
Would you mind reading the document I gave link to? Pay attention to section where it says something about size policies and stretch factors.

rajeshs
13th March 2008, 05:26
how to set these properties in designer ?

jpn
13th March 2008, 06:24
It's the "sizePolicy" property under QWidget category.

rajeshs
18th March 2008, 06:34
I want my dialog to be displayed in particular fixed size initially,and then if we resize it should resize all controlls,

For this need if I apply layout and size policy initially its increasing size,

How to create a dialog with particular fixed size by applying layouts ?

aamer4yu
18th March 2008, 08:44
Keep the sizepolicy as fixed.

rajeshs
18th March 2008, 09:00
I kept sizepolicy as fixed and then i applied layout , now my dialog size is increasing , if i resize in runtime, its not resizing controls in it....

wysota
18th March 2008, 11:50
I want my dialog to be displayed in particular fixed size initially,
So resize() it before showing it.


and then if we resize it should resize all controlls,
Apply a layout to the dialog.