PDA

View Full Version : Show/hide part of dialog with resizing.



Spockmeat
19th May 2006, 21:39
Here's the basic outline of a dialog I have designed:


+--------------------------------------------------+
|Gridlayout->contains "show more" button |
|--------------------------------------------------|
|Gridlayout-> contains more stuff |
+--------------------------------------------------+


Now, what I want to have happen is when the "more" button is pressed, the dialog expands, and the rest of the options are displayed. When it is pressed again, those extra options should just diappear and the dialog should be resized appropriately.

What actually happens is the top gridlayout expands to the size of the whole dialog box. When the more button is pressed, the dialog box is not resized, but the second layout is shown, squishing both within the dialog box.

I've tried setting the layouts, sizes, size preferences, etc to everything I can think of, but it never behaves the way I want it to.

There's an example in the Tutorials/Examples in the docs on trolltech's site http://doc.trolltech.com/4.1/dialogs-extension.html, and I can follow that and get things to work using their set up, but I can't figure out how to do the same thing using just the designer. Does anyone have any suggestions?

Spockmeat
24th May 2006, 22:11
No one has any ideas? I suppose I could just do it in code like the example shows, but using the designer would definitly be the best way if it worked.

wysota
24th May 2006, 23:33
But what exactly doesn't work? Which part you're not able to do with designer?

wysota
24th May 2006, 23:51
That's as close as I can get with doing everything from within designer. Two lines of external code needed.

Spockmeat
25th May 2006, 16:36
Oh thanks, the problem was I needed to stick in one more line:

this->layout()->setSizeConstraint(QLayout::SetFixedSize);
I thought that was something that could be set in the designer. Really, I wish more of the examples would be done in the disigner and not straight code, or perhaps both, it'd make it easier to know which settings can be set and where.

yabadabadoo
7th June 2006, 09:04
Hi,
i want to hide widget(s). But with that i want to shrink the size of Dialog.
i am using 4 or 5 QGroupBox and under it other widgets. when i hide one QGroupBox using hide(), other boxes adjust there size in free space. I want to shrink the Dialog Box when i hide the QGroupBox .
<BR>

wysota
7th June 2006, 09:22
You can use the same solution. Take a look at the archive in my previous post in this thread.