I'm working with Qt (version 4.6 on Windows XP 32-bit and compiling in Qt Creator 2.0.0) and trying to get a QWizard to work out.
First Problem:
I have three QWizardPages in my QWizard so far. Each page has a QVBoxLayout applied as it's layout. My first page has very small content (just a three line QLabel) but for some reason there is quite a bit of white space between the QLabel and the "< Back", "Next >" and "Cancel" button pane. I want each page to have the minimum amount of white space based on the content inside it. In the past, when I've put a QVBoxLayout in a parentless QWidget 开发者_运维问答(it's own window), the window was always just small enough to fix the QVBoxLayout. Now there is extra whitespace. Is there some option that I have to turn off or on so that the QWizardPages are as small as possible?
Second (and mostly likely related to the first) Problem:
Also, my second page is much larger than my first page, so when I get to the second page and come back to the first page, the first page maintains the same size as the second page but only after I have visited the second page. Is this a bug?
The only geometry setting I am doing is when I do a
move(50, 50);
in the QWizard constructor. No resizes... nothing explicit. I'm trying to let the layouts do their magic.
Thanks for your help in advanced.
To fix this problem, I created a child class of QWizard and created a private slot like this:
void ChildClass::fitContents(int id)
{
adjustSize(); // this automagically resizes the window to fit the contents
}
And made it had it called every time the page was changed, like so:
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(fitContents(int)));
精彩评论