QWizard Class Reference
The QWizard class provides a framework for wizard dialogs.
More...
#include <qwizard.h>
Inherits QDialog.
List of all member functions.
Public Members
QWizard ( QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )
virtual void
addPage ( QWidget * page, const QString & title )
virtual void
insertPage ( QWidget * page, const QString & title, int index )
QString
title ( QWidget * page ) const
void
setTitle ( QWidget * page, const QString & title )
virtual void
showPage ( QWidget * page )
QWidget *
page ( int index ) const
int
indexOf ( QWidget * page ) const
Public Slots
Signals
Properties
QFont
titleFont - the font used for page titles
Protected Members
virtual void
layOutTitleRow ( QHBoxLayout * layout, const QString & title )
Protected Slots
Detailed Description
The QWizard class provides a framework for wizard dialogs.
A wizard is a special type of input dialog that consists of a sequence of dialog pages.
A wizard's purpose is to assist a user by automating a task and by walking the user through
the process step by step. Wizards are useful for complex or infrequently occurring tasks that people
may find difficult to learn or do.
QWizard provides page titles and displays Next, Back, Finish, Cancel, and Help push buttons, as
appropriate to the current position in the page sequence.
Create and populate dialog pages inheriting from QWidget and add them to the wizard using addPage().
Use insertPage() to add a dialog page at a certain position in the page sequence. Use removePage() to remove
a page from the page sequence.
Use currentPage() to retrieve a pointer to the currently displayed page. page() returns a pointer to the page at a certain
position in the page sequence.
Use pageCount() to retrieve the total number of pages in the page sequence. indexOf() will return the index of a page in the
page sequence.
QWizard provides functionality to mark pages irrelevant for the current context. Use setAppropriate() to mark a page (ir)relevant for
the current context. The idea is that a page may be irrelevant and should be skipped depending on the data entered by the user on
a preceding page.
It is considered good design to provide a greater number of simple pages with fewer choices instead of a smaller
number of complex pages.
Example code is available here: wizard/wizard.cpp wizard/wizard.h
Member Function Documentation
QWizard::QWizard ( QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )
Constructs an empty wizard dialog.
The parent, name, modal and f arguments are passed to
the QDialog constructor.
QWizard::~QWizard ()
Destroys the object and frees any allocated resources, including,
of course, all pages and controllers.
void QWizard::addPage ( QWidget * page, const QString & title ) [virtual]
Adds page to the end of the page sequence, titled title.
bool QWizard::appropriate ( QWidget * page ) const [virtual]
Called when the Next button is clicked; this virtual function returns
TRUE if page is relevant for display in the current context, and FALSE
if QWizard should ignore it. The default implementation returns the value set
using setAppropriate(). The ultimate default is TRUE.
Warning: The last page of the wizard will be displayed if no page is relevant
in the current context.
void QWizard::back () [virtual protected slot]
Called when the user clicks the Back button; this function shows
the page preceding the currently visible page in the page sequence.
QPushButton * QWizard::backButton () const
Returns a pointer to the Back button of the dialog.
By default, this button is connected to the back() slot,
which is virtual so you may reimplement it in a QWizard subclass.
QPushButton * QWizard::cancelButton () const
Returns a pointer to the Cancel button of the dialog.
By default, this button is connected to the QDialog::reject() slot,
which is virtual so you may reimplement it in a QWizard subclass.
QWidget * QWizard::currentPage () const
Returns a pointer to the current page in the sequence.
Although the wizard does its best to make sure that this value is
never 0, it can be if you try hard enough.
QPushButton * QWizard::finishButton () const
Returns a pointer to the Finish button of the dialog.
By default, this button is connected to the QDialog::accept() slot,
which is virtual so you may reimplement it in a QWizard subclass.
void QWizard::help () [virtual protected slot]
Called when the user clicks the Help button, this fucntion emits the
helpClicked() signal.
QPushButton * QWizard::helpButton () const
Returns a pointer to the Help button of the dialog.
By default, this button is connected to the help() slot,
which is virtual so you may reimplement it in a QWizard subclass.
void QWizard::helpClicked () [signal]
This signal is emitted when the user clicks on the Help button.
int QWizard::indexOf ( QWidget * page ) const
Returns the page index of page in the sequence.
If the page is not part of the wizard -1 is returned.
void QWizard::insertPage ( QWidget * page, const QString & title, int index ) [virtual]
Inserts page at index index into the page sequence, titled title.
If index equals -1, the page will be appended to the end of the wizard.
void QWizard::layOutButtonRow ( QHBoxLayout * layout ) [virtual protected]
This virtual function is responsible for adding the bottom
divider and buttons below it.
layout is the vertical layout of the entire wizard.
void QWizard::layOutTitleRow ( QHBoxLayout * layout, const QString & title ) [virtual protected]
This virtual function is responsible for laying out the title row
and adding the vertical divider between the title and the wizard page.
layout is the vertical layout for the wizard, and title is the title
for this page. This function is called every time title
changes.
void QWizard::next () [virtual protected slot]
Called when the user clicks the Next button, this function shows
the next relevant page in the sequence.
See also appropriate().
QPushButton * QWizard::nextButton () const
Returns a pointer to the Next button of the dialog.
By default, this button is connected to the next() slot,
which is virtual so you may reimplement it in a QWizard subclass.
QWidget * QWizard::page ( int index ) const
Returns a pointer to the page at index index in the sequence, or 0 if index is out of range.
The first page has index 0.
int QWizard::pageCount () const
Returns the number of pages in the wizard.
void QWizard::removePage ( QWidget * page ) [virtual]
Removes page from the page sequence but does not delete the page.
If page is currently being displayed, QWizard will display another page.
void QWizard::selected ( const QString & ) [signal]
This signal is emitted when the current page changes, signalling
the title of the page.
void QWizard::setAppropriate ( QWidget * page, bool appropriate ) [virtual]
If appropriate is TRUE then page page is considered relevant
in the current context and should be displayed in the page sequence;
otherwise page should not be displayed in the page sequence.
See also appropriate().
void QWizard::setBackEnabled ( QWidget * page, bool enable ) [virtual slot]
If enable is TRUE, page page has a Back button; otherwise page has no Back button.
By default all pages have this button.
void QWizard::setFinish ( QWidget *, bool ) [virtual slot]
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.
Use setFinishEnabled instead
void QWizard::setFinishEnabled ( QWidget * page, bool enable ) [virtual slot]
If enable is TRUE, page page has a Finish button; otherwise page has no Finish button.
By default no pages have this button.
void QWizard::setHelpEnabled ( QWidget * page, bool enable ) [virtual slot]
If enable is TRUE, page page has a Help button; otherwise page has no Help button.
By default all pages have this button.
void QWizard::setNextEnabled ( QWidget * page, bool enable ) [virtual slot]
If enable is TRUE, page page has a Next button; otherwise page has no Next button.
By default all pages have this button.
void QWizard::setTitle ( QWidget * page, const QString & title )
Sets the title for page page to title.
void QWizard::setTitleFont ( const QFont & )
Sets the font used for page titles. See the "titleFont" property for details.
void QWizard::showPage ( QWidget * page ) [virtual]
Makes page the current page and emits the selected() signal.
Example: wizard/wizard.cpp.
QString QWizard::title ( QWidget * page ) const
Returns the title of page page.
QFont QWizard::titleFont () const
Returns the font used for page titles. See the "titleFont" property for details.
Property Documentation
This property holds the font used for page titles.
Set this property's value with setTitleFont() and get this property's value with titleFont().
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit,
copyright © 1995-2001
Trolltech, all rights reserved.
Copyright © 2001 Trolltech | Trademarks
| Qt version 3.0.0-beta1-beta1
|