InBlock.gif
#include <QtGui> 

InBlock.gif 

InBlock.gif
//介绍页 

InBlock.gifQWizardPage *createIntroPage() 

InBlock.gif

InBlock.gif        QWizardPage *page = 
new QWizardPage; 

InBlock.gif        page->setTitle(QObject::trUtf8(
"介绍")); 

InBlock.gif 

InBlock.gif        QLabel *label = 
new QLabel(QObject::trUtf8(
"该向导将辅助你完成此产品" 

InBlock.gif                                                             
"的注册.")); 

InBlock.gif        
//label->setWordWrap(true); 

InBlock.gif 

InBlock.gif        QVBoxLayout *layout = 
new QVBoxLayout; 

InBlock.gif        layout->addWidget(label); 

InBlock.gif        page->setLayout(layout); 

InBlock.gif 

InBlock.gif        
return page; 

InBlock.gif

InBlock.gif 

InBlock.gif
//创建注册页 

InBlock.gifQWizardPage *createRegistrationPage() 

InBlock.gif

InBlock.gif        QWizardPage *page = 
new QWizardPage; 

InBlock.gif        page->setTitle(QObject::trUtf8(
"注册")); 

InBlock.gif        page->setSubTitle(QObject::trUtf8(
"请填写全部两项:")); 

InBlock.gif 

InBlock.gif        QLabel *nameLabel = 
new QLabel(QObject::trUtf8(
"姓名:")); 

InBlock.gif        QLineEdit *nameLineEdit = 
new QLineEdit; 

InBlock.gif 

InBlock.gif        QLabel *emailLabel = 
new QLabel(QObject::trUtf8(
"电子邮箱:")); 

InBlock.gif        QLineEdit *emailLineEdit = 
new QLineEdit; 

InBlock.gif 

InBlock.gif        QGridLayout *layout = 
new QGridLayout; 

InBlock.gif        layout->addWidget(nameLabel, 0, 0); 

InBlock.gif        layout->addWidget(nameLineEdit, 0, 1); 

InBlock.gif        layout->addWidget(emailLabel, 1, 0); 

InBlock.gif        layout->addWidget(emailLineEdit, 1, 1); 

InBlock.gif        page->setLayout(layout); 

InBlock.gif 

InBlock.gif        
return page; 

InBlock.gif

InBlock.gif 

InBlock.gif
//创建结束页 

InBlock.gifQWizardPage *createConclusionPage() 

InBlock.gif

InBlock.gif        QWizardPage *page = 
new QWizardPage; 

InBlock.gif        page->setTitle(QObject::trUtf8(
"结束语")); 

InBlock.gif 

InBlock.gif        QLabel *label = 
new QLabel(QObject::trUtf8(
"你已经成功注册." 

InBlock.gif                                                             
"祝您心情愉快!")); 

InBlock.gif        label->setWordWrap(
true); 

InBlock.gif 

InBlock.gif        QVBoxLayout *layout = 
new QVBoxLayout; 

InBlock.gif        layout->addWidget(label); 

InBlock.gif        page->setLayout(layout); 

InBlock.gif 

InBlock.gif        
return page; 

InBlock.gif

InBlock.gif 

InBlock.gif
int main(
int argc, 
char *argv[]) 

InBlock.gif

InBlock.gif        QApplication app(argc, argv); 

InBlock.gif 

InBlock.gif        QWizard wizard; 

InBlock.gif        wizard.addPage(createIntroPage()); 

InBlock.gif        wizard.addPage(createRegistrationPage()); 

InBlock.gif        wizard.addPage(createConclusionPage()); 

InBlock.gif 

InBlock.gif        wizard.setWindowTitle(QObject::trUtf8(
"软件注册向导")); 

InBlock.gif        wizard.show(); 

InBlock.gif 

InBlock.gif        
return app.exec(); 

InBlock.gif

 
 
注册向导之类的:
 
 
本文转自 xcf007 51CTO博客,原文链接:http://blog.51cto.com/xcf007/106761,如需转载请自行联系原作者