class WIZARD : public QWizard{ Q_OBJECTpublic: WIZARD(QWidget *parent = 0);};class One : public QWizardPage{ Q_OBJECTpublic: One(QWidget *parent = 0); int nextId() const;};class Two : public QWizardPage{ Q_OBJECTpublic: Two(QWidget *parent = 0); int nextId() const; void initializePage();private: void test(); QProgressBar *progBar;};class Three : public QWizardPage{ Q_OBJECTpublic: Three(QWidget *parent = 0);};
WIZARD::WIZARD(QWidget *parent) : QWizard(parent){ setPage(0, new One); setPage(1, new Two); setPage(2, new Three); setStartId(0);}One::One(QWidget *parent) : QWizardPage(parent){}int One::nextId() const{ return 1;}Two::Two(QWidget *parent) : QWizardPage(parent){ progBar = new QProgressBar; progBar->setMaximum(3); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(progBar); setLayout(layout);}void Two::initializePage() { test();}void Two::test() { QTest::qWait(500); progBar->setValue(1); QTest::qWait(500); progBar->setValue(2); QTest::qWait(500); progBar->setValue(3);}int Two::nextId() const{ return 2;}Three::Three(QWidget *parent) : QWizardPage(parent){}
C++ (Qt)void Two::initializePage() { test();}
C++ (Qt)void Two::setVisible( bool set ) { QWizardPage::setVisible( set ); if( set ) test();}
C++ (Qt)void WIZARD::showPage( int id ){ if( id == 1 ) { Two* two = dynamic_cast< Two* >( page( id ) ); two->test(); }}