[Qt-interest] QWizardPage fields registered globally?

Zack Galbreath zack.galbreath at gmail.com
Tue Jan 12 22:29:54 CET 2010


Hi list,

I'm using Qt 4.6 to build a QWizard of four pages.  I need to be able to 
control when the back/next/finished buttons are enabled, so I subclassed 
QWizardPage and made use of the registerField() method.  My problem is 
that if I register a required field on page #4 it prevents the "next" 
button on page #1 from ever being enabled.  Why do the registered fields 
of page #4 have anything at all to do with page #1?

I have a hunch it's because the properties I'm registering belong not to 
the individual QWizardPages, but to the parent QWizard itself.  Here's a 
code snippet from my first page to illustrate.  In this example, 
"InputFileName" is a property of MyWizard.


void MyIntroPage::RegisterFields()
{
  MyWizard *wiz = static_cast<MyWizard*>(this->wizard());
  this->registerField("InputFileName*", wiz, "InputFileName",
                      SIGNAL(inputChanged()));
}


Normally I try to do a better job of encapsulating my code, but Designer 
assigned all my widgets to be children of the QWizard, as opposed to the 
separate QWizardPages.  Does anyone have any suggestions on how to setup 
different required fields on each page of a QWizard?

TIA,
-Zack



More information about the Qt-interest-old mailing list