Saturday, July 5th 2008, 4:55am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

seguprasad

Trainee

Posts: 103

Location: INDIA

Occupation: Developer

1

Wednesday, November 28th 2007, 1:14pm

Change in controls size with layout.

Hi All,

I have 4 group boxes on my dialog. Each group box is having some labels, line edits and push buttons. The size of each group box is different. My requirement is to resize all these controls upon resizing of dialog. So that I placed all these 4 group boxes in a grid layout. Unfortunately the size of the groups are getting changed even at the design time.

Can any one help me how to fix the sizes of group boxes even we place them in grid layout?

Thanks,
-Segu,
  • Go to the top of the page

lfish

Beginner

Posts: 1

Location: Colorado Springs, CO

2

Tuesday, January 29th 2008, 5:31pm

RE: Change in controls size with layout.

Hi Segu,

I'm running into a similar problem and I'm wondering if you've found a solution for it? Every time I put controls into a horizontal layout, the designer resizes them. I've tried setting the size policy and Designer ignores it. I can't think of anything else to try except for possibly writing code to reset the sizes of the buttons after or during initialization.

Thanks,

-Larry
  • Go to the top of the page

seguprasad

Trainee

Posts: 103

Location: INDIA

Occupation: Developer

3

Thursday, January 31st 2008, 3:42am

Hi, Larry,

I have solved the problem in some way. But I don't know whether the way I followed is correct. But I got the required functionality.

I followed the following steps,

- Used appropriate layout for all the controls in each group box. Every group box may require different type of layout.
- Used appropriate layout for all the group boxes in dialog level. Generally it may be vertical or grid layout depending upon the group box placement on your dialog.
- All the controls on the dialog should be in some layout.

Then it is working fine with me.

Let me know if you any problem

-Segu
-Segu,
  • Go to the top of the page

Posts: 59

Location: India

Occupation: Software Developer

4

Thursday, February 7th 2008, 12:12pm

Hi,
Their is no problem with Qt. As when you place two widgets in a layout Qt itself try to resize it to fit into the layout. as if you want that controls of different size should get into single layout then try to use spacer.

Try to set their size policy like set minimum size of group boxes etc. Or directly use multiple layouts to achieve this along with spacer.

I am attaching a image for your help.

Let me know if you have any problem.
rajeevpodar has attached the following file:
  • layout.jpg (3.93 MB - 168 times downloaded - Last download: Jul 3rd 2008, 7:59pm)
Cheers,
Rajiv
Be DEAF when people tell you that you can't fulfill your dreams.

This post has been edited 1 times, last edit by "rajeevpodar" (Feb 7th 2008, 12:15pm)

  • Go to the top of the page

5

Saturday, March 8th 2008, 8:39pm

But still you can control the size of widgets using spacers. But you must switch your thinking from absolute values (pixels) to relative values (percentage of available space).
  • Go to the top of the page

Rate this thread