Skip to content

QWizard v4

Wednesday, 11 April 2007  |  jaroslaw staniek

BTW, new Qt4.3's QWizards's field system (see QWizard::field()) looks really useful. It is a clean version of approach to the one we discussed last year -- where we refer to pages/data widgets by name (or ID) and not by pointer.

For certain purposes I also value the freedom of choosing between QWizardPage::nextId() and QWizard::nextId().

Implementing wizards (now in KDE: assistants) wes always less exciting than core functionality of an app. Now there are chances for some cleaner code.

Maybe one missing stuff is single operation for setting and retrieving data to/from fields:

 void QWizard::setFields(const QMap<QString, QVariant>& values);
 QMap<QString, QVariant> QWizard::fields() const;

Thus, we could utilize the model/view approach a bit more:

  • use fields() to pass results of using the wizard after its object is destroyed
  • use setFields() for delayed initialization of data widgets -- usable when we delay creation of page contents to improve performance -- QWizard can initialize data widgets with values predefined by the QMap, as soon as new page fields are registered by QWizardPage::registerField().