Home · All Classes · Annotated · Functions

QWizard Class Reference

The QWizard class provides a simple wizard implementation More...

#include <QWizard>

Inherits QWidget.

Properties

Public Functions

Public Slots

Signals

Additional Inherited Members


Detailed Description

The QWizard class provides a simple wizard implementation

To use the Wizard follow these steps:

Note: if one page of the wizard has controls which enable and disable other pages use connectPageEnabler instead of calling setAppropriate manually.


Property Documentation

nextText : QString

This property holds the text shown on the "next" button.

This property that is shown on the "next" button. By default this property is initialized to "&Next >"

Access functions:

prevText : QString

This property holds the text shown on the "back" button.

This property that is shown on the "back" button. By default this property is initialized to "< &Back"

Access functions:


Member Function Documentation

QWizard::QWizard ( QWidget * parent = 0, Qt::WFlags f = 0 )

Create a new Qtopia QWizard with parent parent and flags f. This is a small compact wizard with a simple label at the top for each page and only two buttons at the bottom to control pages. On the phone edition, the page switching is performed via context bar buttons and the page GUI buttons are not displayed.

On the first appropriate page of the QWizard the two buttons are labelled cancel and next. On the last appropriate page they are labelled previous and finish. On all other pages the buttons are labelled previous and next. The context menu contains cancel and finish, as well as previous and next options.

QWizard::~QWizard ()   [virtual]

Deconstructs QWizard.

void QWizard::aboutToShowPage ( int page )   [signal]

This signal is emitted before the page page is shown. By connecting to this signal some last minute preparations on page can be done.

void QWizard::accept ()   [signal]

This signal is emitted if the user has clicked on the Finish button.

void QWizard::addPage ( QWidget * w )

Add the widget page w to this QWizard. It will be added at the end of the sequence of pages. Note: the windowTitle property of the widget is used to set the QWizard page title and finishButton is false for each page by default. If this is the last page finishButton( w, true ) must be called.

This method re-parents w onto the internal stacked widget in the QWizard. Note: re-parenting warnings can be safely ignored.

If no title is set a page title will be created using the index of the page and the object name of the widget.

void QWizard::connectPageEnabler ( QObject * o, const char * s, QWidget * w )

Connect the source object o signal s to the page w set appropriate. The signal must supply a boolean. The signals are mux'ed using a QSignalMapper so that when the object widget is toggled, the page's appropriate setting is toggled. Useful for turning pages "on" and "Off" depending on a choices checkbox. Since pages are initially enabled, toggle check boxes should be initially checked, so the toggling to checked/true toggles the page to enabled/true.

QWidget * QWizard::currentPage () const

Returns a pointer to the page at the current position or 0 if there is no pages in the QWizard.

int QWizard::indexOf ( QWidget * w ) const

Returns the index of widget w, or -1 if w is not a child.

void QWizard::loadPages ( QObject * p = 0 )

Load widget pages parented onto object p into the pagelist. If p is 0 (NULL) then it loads pages parented onto itself. The QWizard will treat any QWidget which is a direct child of object p (that is, resides in p's children() list) as a page. This indicates that making widgets a child of the QWizard in a UI file, and using p = 0 will make them pages. loadPages() should be called before trying to do anything with pages set by parenting, or calls to setAppropriate() and page() which assume pages will fail. The widget pages requires the windowTitle or caption property to be set as this is used for the title of the page.

    QWizard *wiz = new QWizard;
    QWidget page1 = new QWidget( wiz );
    page1->setWindowTitle( "First page" );  // specifically set title
    QWidget *page2 = new MyPage2( wiz );    // custom ctor sets windowTitle
    wiz->loadPages();                       // OK to set things on pages now
    wiz->setAppropriate( page1, false );
    page2->setWindowTitle( "Second page" ); // can change title later

QWidget * QWizard::page ( int index ) const

Returns a pointer to the page at position index in the sequence, or 0 if there is no such index. The first page has index 0.

void QWizard::reject ()   [signal]

This signal is emitted if the user has clicked on the Cancel button.

void QWizard::setAppropriate ( QWidget * w, bool app )   [virtual slot]

If app is true then page w is considered relevant in the current context and should be displayed in the page sequence; otherwise the page should not be displayed in the page sequence.

void QWizard::setFinishEnabled ( QWidget * w, bool enabled )   [slot]

If enabled is true, the Finish button on page w may be enabled, otherwise it is disabled. Note: Finish is displayed in the place of the Next button, and Next has priority. To set finish, first use setNextEnabled( w, false ) which also disables Finish in the context menu.

This should not need to be called generally because the last appropriate page in the sequence will automatically have a finish button displayed.

void QWizard::setNextEnabled ( QWidget * w, bool enabled )   [slot]

If enabled is true, the Next button on page w is enabled, otherwise it is disabled. This can be used to disable moving forward in a QWizard until the page has been validly completed.

void QWizard::setPrevEnabled ( QWidget * w, bool enabled )   [slot]

If enabled is true, the Prev button on page w is enabled, otherwise it is disabled. On the first appropriate page in the sequence Prev is always disabled and a cancel button is displayed instead.

void QWizard::showPage ( int page )   [virtual slot]

Display the page with index page. Emits aboutToShowPage( page ) signal.


Copyright © 2006 Trolltech Trademarks
Qtopia 4.1.7