ij-16.png   inspectorJ -- JavaTM Profiler
sf project site browse source checkout source
SourceForge.net Logo



inspectorj::client::WizardControl Class Reference

#include <wizardcontrol.h>

List of all members.


Detailed Description

WizardControl provides simple navigation support for navigating forward and backward through a multi-page wizard style dialog or form.

Each page must be a QWidget or a subclass. Backward and Forward navigation controls must be a subclass of QAbstractButton. The controls will be wired up automatically to display the appropriate page. The back and forward buttons will be enabled or disabled based on whether there are more pages to display in either direction. If you want to add additional criteria for enabling the navigation buttons (such as validating that all required fields are completed) you can connect one or more of the available signals to a slot to perform validation. All signals are emitted after navigation is complete. This gives you the opportunity to override the default enable/disable behavior.

Usage: To use the WizardControl you only need to supply a list of pages and pointers to your backward and forward controls to the constructor.

 class MyDialog : public QDialog
 {
 
 .. SNIP ..

 public slots:
     void validatePage(int pageNum);
     void changeDialogTitle(int pageNum);
 
 private:
     // The wizard control
     WizardControl *wizard;
 
     // The pages
     QWidget *page1;
     QWidget *page2;
     QWidget *page3;
     
     // The navigation controls
     QPushButton *backBtn;
     QPushButton *nextBtn;
     
     // QList to hold the pages
     QList<QWidget*> pages;
 
 }
 
 
 //constructor
 MyDialog::MyDialog()
 {
     // initialize the gui first
     MyDialog::setupUi(this);
 
     // initialize the wizard control
     pages.append(page1);
     pages.append(page2);
     pages.append(page3);
     wizard = new WizardControl(&pages, backBtn, nextBtn);

     // change the dialog's title when the current page changes
     connect (wizard, SIGNAL(pageChanged(int)), this, SLOT (changeDialogTitle(int)));

     // perform validation when we reach the last page
     connect (wizard, SIGNAL(lastPage(int)), this, SLOT (validatePage(int)));
 }
 

Author:
James May

Definition at line 108 of file wizardcontrol.h.

Signals

void pageChanged (int pageNum)
 Signal emitted after a backward or forward navigation.
void pageForward (int pageNum)
 Signal emitted after there is a forward navigation.
void pageBackward (int pageNum)
 Signal emitted after there is a backward navigation.
void firstPage ()
 Signal emitted when a navigation action results in the current page being the first page.
void lastPage (int pageNum)
 Signal emitted when a navigation action results in the current page being the last page.

Public Member Functions

 WizardControl (QList< QWidget * > *, QAbstractButton *, QAbstractButton *)
 Constructor.
 ~WizardControl ()
 Destructor.
int getNumPages ()
 Return the number of pages for this wizard.
int getCurrentPageNum ()
 Return the current page number for this wizard.

Private Slots

void previousPage ()
 Switch to the previous page.
void nextPage ()
 Switch to the next page.

Private Member Functions

void updateNavigationBtns ()
 Update navigation Buttons.

Private Attributes

int currentPage
 Page number of the currently displayed page.
QList< QWidget * > * pages
 A list of pages.
QAbstractButton * backNavCtrl
 Button Widget for backward navigation.
QAbstractButton * nextNavCtrl
 Button Widget for forward navigation.


Constructor & Destructor Documentation

inspectorj::client::WizardControl::WizardControl ( QList< QWidget * > *  pages,
QAbstractButton *  backNavCtrl,
QAbstractButton *  nextNavCtrl 
)

Constructor.

Parameters:
pages List of pages to navigate
backNavCtrl A QAbstractButton used to navigate backwards
nextNavCtrl A QAbstractButton used to navigate forward

Definition at line 40 of file wizardcontrol.cpp.

References nextPage(), previousPage(), and updateNavigationBtns().

inspectorj::client::WizardControl::~WizardControl (  ) 

Destructor.

Definition at line 62 of file wizardcontrol.cpp.


Member Function Documentation

int inspectorj::client::WizardControl::getNumPages (  ) 

Return the number of pages for this wizard.

Returns:
the total number pages

Definition at line 70 of file wizardcontrol.cpp.

References pages.

Referenced by inspectorj::client::SessionProfileDialog::updateNavigationBtns().

int inspectorj::client::WizardControl::getCurrentPageNum (  ) 

Return the current page number for this wizard.

Returns:
1 based index of the currently displayed page.

Definition at line 79 of file wizardcontrol.cpp.

References currentPage.

Referenced by inspectorj::client::SessionProfileDialog::updateNavigationBtns().

void inspectorj::client::WizardControl::pageChanged ( int  pageNum  )  [signal]

Signal emitted after a backward or forward navigation.

Parameters:
pageNum 1-based index of the current page after the navigation.

Referenced by nextPage(), and previousPage().

void inspectorj::client::WizardControl::pageForward ( int  pageNum  )  [signal]

Signal emitted after there is a forward navigation.

Parameters:
pageNum 1-based index of the current page after the navigation.

Referenced by nextPage().

void inspectorj::client::WizardControl::pageBackward ( int  pageNum  )  [signal]

Signal emitted after there is a backward navigation.

Parameters:
pageNum 1-based index of the current page after the navigation.

Referenced by previousPage().

void inspectorj::client::WizardControl::firstPage (  )  [signal]

Signal emitted when a navigation action results in the current page being the first page.

In this case the current page will always be 1.

Referenced by previousPage().

void inspectorj::client::WizardControl::lastPage ( int  pageNum  )  [signal]

Signal emitted when a navigation action results in the current page being the last page.

Parameters:
pageNum 1-based index of the current page after the navigation.

Referenced by nextPage().

void inspectorj::client::WizardControl::previousPage (  )  [private, slot]

Switch to the previous page.

Definition at line 87 of file wizardcontrol.cpp.

References currentPage, firstPage(), nextNavCtrl, pageBackward(), pageChanged(), pages, and updateNavigationBtns().

Referenced by WizardControl().

void inspectorj::client::WizardControl::nextPage (  )  [private, slot]

Switch to the next page.

Definition at line 108 of file wizardcontrol.cpp.

References backNavCtrl, currentPage, lastPage(), pageChanged(), pageForward(), pages, and updateNavigationBtns().

Referenced by WizardControl().

void inspectorj::client::WizardControl::updateNavigationBtns (  )  [private]

Update navigation Buttons.

Definition at line 129 of file wizardcontrol.cpp.

References backNavCtrl, currentPage, nextNavCtrl, and pages.

Referenced by nextPage(), previousPage(), and WizardControl().


Member Data Documentation

int inspectorj::client::WizardControl::currentPage [private]

Page number of the currently displayed page.

Definition at line 160 of file wizardcontrol.h.

Referenced by getCurrentPageNum(), nextPage(), previousPage(), and updateNavigationBtns().

QList<QWidget*>* inspectorj::client::WizardControl::pages [private]

A list of pages.

Definition at line 163 of file wizardcontrol.h.

Referenced by getNumPages(), nextPage(), previousPage(), and updateNavigationBtns().

QAbstractButton* inspectorj::client::WizardControl::backNavCtrl [private]

Button Widget for backward navigation.

Definition at line 166 of file wizardcontrol.h.

Referenced by nextPage(), and updateNavigationBtns().

QAbstractButton* inspectorj::client::WizardControl::nextNavCtrl [private]

Button Widget for forward navigation.

Definition at line 169 of file wizardcontrol.h.

Referenced by previousPage(), and updateNavigationBtns().


The documentation for this class was generated from the following files:
Generated on Sun Aug 19 17:08:16 2007 for inspectorJ by  doxygen 1.5.1