PDA

View Full Version : QWizard fit



baray98
4th October 2008, 00:04
I was using QWizard and added some pages that contain widget of different sizes and it seems that QWizard will adjust itself as the the widget inside it grows bigger but won't shrink if the next widget is smaller than the previous one.

I want to have it tight fit on the QWizardPage size. Is there such a way to do it?

like using QLayout::setSizeConstraint(QLayout::SetFixedSize) kinda thing...

baray98

jpn
5th October 2008, 08:24
So QLayout::setSizeConstraint(QLayout::SetFixedSize) does not work? Have you tried it for QWizardPage or QWizard itself?

baray98
6th October 2008, 03:19
jpn,

QLayout::setSizeConstraint(QLayout::SetFixedSize) applied on the QWizardPage just makes the page "fixed size" but the QWizard remains unchanged.

tried accessing the layout on QWizard with QWidget::layout() but this will return 0 so I can't tell wizard to wrap it up using QLayout::setSizeConstraint(QLayout::SetFixedSize)

baray98

kalos80
5th June 2009, 14:18
I have the same identical problem.
Has anyone a solution to this problem?

Thanks

baray98
6th June 2009, 01:00
There is no solution that I know at this point in time

jpn
6th June 2009, 09:10
Do you really want the wizard dialog to automatically resize back and forth meanwhile the user switches between pages? I don't think that's a good idea, because the location of the next/cancel/whatever buttons would change all the time. Users are used to navigating in wizards so that they keep clicking for example the next button. With your approach one could easily click the cancel button by accident while the intention was to press next.

kalos80
8th June 2009, 11:02
good point jpn.
I agree it would be a good idea to set the wizard size to the size of its biggest page.
Do you know how to do this? By default the wizard adapt to the current page size.

My real problem is slightly different: I have a page in the wizard with a "more" button that changes the wizard page to show addition controls in the page.
The problem is that when the "more" is clicked the wizard page is properly resized, but that does not cause the resize of the Wizard.

In the wizard page constructor I set the wizardpage layout to fixed size



...
layout()->setSizeConstraint(QLayout::SetFixedSize);
...


then when the "more" button is clicked I call a slot hiding/showing a button group with additional controls



...
gbAdvancedOptions->setVisible(yes);
...


As I said before, the wizard page is properly resized, but the wizard is not, so I can not see the additional controls. I have to resize the wizard manually to see them.
I tried the fallowing solution, but it is not working



...
gbAdvancedOptions->setVisible(yes);
wizard()->adjustSize();
...


Do you have any other suggestion?
Thanks in advance for your help

dao
14th November 2010, 16:27
Call adjustSize() member of all pages.
Get biggest size (biggestSize) resulting sizes
and setFixedSize(biggestSize);
Now all pages have the same size.