C++ (Qt)#ifndef CREATEPROJECT_H#define CREATEPROJECT_H #include <QtGui/QWizard>#include <QPushButton>namespace Ui { class CreateProject;} class CreateProject : public QWizard { Q_OBJECT Q_DISABLE_COPY(CreateProject)public: explicit CreateProject(QWidget *parent = 0); virtual ~CreateProject(); protected: virtual void changeEvent(QEvent *e);private: Ui::CreateProject *m_ui;}; #endif // CREATEPROJECT_H
C++ (Qt)#include "createproject.h"#include "ui_createproject.h" CreateProject::CreateProject(QWidget *parent) : QWizard(parent), m_ui(new Ui::CreateProject){ m_ui->setupUi(this);} CreateProject::~CreateProject(){ delete m_ui;} void CreateProject::changeEvent(QEvent *e){ switch (e->type()) { case QEvent::LanguageChange: m_ui->retranslateUi(this); break; default: break; }}
C++ (Qt)CreateProject create; create.exec();
<?xml version="1.0" encoding="UTF-8"?><ui version="4.0"> <class>CreateProject</class> <widget class="QWizard" name="CreateProject"> <property name="windowModality"> <enum>Qt::WindowModal</enum> </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>431</width> <height>324</height> </rect> </property> <property name="windowTitle"> <string>Wizard</string> </property> <property name="windowIcon"> <iconset> <normaloff>:/ico/Icons/asterisk_orange.png</normaloff>:/ico/Icons/asterisk_orange.png</iconset> </property> <property name="wizardStyle"> <enum>QWizard::ModernStyle</enum> </property> <widget class="QWizardPage" name="wizardPage1"> <widget class="QFrame" name="stepIndicator1"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>130</width> <height>250</height> </rect> </property> <property name="autoFillBackground"> <bool>true</bool> </property> <property name="styleSheet"> <string>background-image:url(:/img/Images/createProject1.png)</string> </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> </widget> <widget class="QWidget" name="gridLayoutWidget"> <property name="geometry"> <rect> <x>140</x> <y>10</y> <width>285</width> <height>241</height> </rect> </property> <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> <widget class="QLabel" name="projectNameLabel"> <property name="text"> <string>Project Name</string> </property> </widget> </item> <item row="0" column="1"> <widget class="QLineEdit" name="lineEdit"/> </item> <item row="1" column="0"> <widget class="QLabel" name="projectDescriptionLbl"> <property name="text"> <string>Description</string> </property> </widget> </item> <item row="1" column="1"> <widget class="QPlainTextEdit" name="plainTextEdit"/> </item> <item row="2" column="1"> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QLabel" name="projectVersionLbl"> <property name="text"> <string>Version</string> </property> </widget> </item> <item> <widget class="QDoubleSpinBox" name="doubleSpinBox"> <property name="singleStep"> <double>0.010000000000000</double> </property> <property name="value"> <double>0.010000000000000</double> </property> </widget> </item> <item> <widget class="QLabel" name="projectBuildLbl"> <property name="text"> <string>Build</string> </property> </widget> </item> <item> <widget class="QSpinBox" name="spinBox"/> </item> </layout> </item> <item row="3" column="1"> <widget class="QCheckBox" name="onlineMode"> <property name="text"> <string>Online services</string> </property> </widget> </item> <item row="4" column="1"> <widget class="QLabel" name="tipLbl"> <property name="text"> <string>Fuck off, asshole</string> </property> </widget> </item> </layout> </widget> </widget> <widget class="QWizardPage" name="wizardPage2"> <widget class="QFrame" name="stepIndicator2"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>130</width> <height>250</height> </rect> </property> <property name="styleSheet"> <string>background-image:url(:/img/Images/createProject2.png)</string> </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> </widget> <widget class="QWidget" name="gridLayoutWidget_2"> <property name="geometry"> <rect> <x>140</x> <y>0</y> <width>291</width> <height>251</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_2"> <item row="2" column="1"> <widget class="QListWidget" name="listWidget"/> </item> <item row="2" column="2"> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>40</width> <height>20</height> </size> </property> </spacer> </item> <item row="3" column="1"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> </size> </property> </spacer> </item> <item row="2" column="0"> <spacer name="horizontalSpacer_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>40</width> <height>20</height> </size> </property> </spacer> </item> <item row="0" column="1"> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> </size> </property> </spacer> </item> <item row="1" column="1"> <widget class="QLineEdit" name="lineEdit_2"/> </item> </layout> </widget> </widget> </widget> <resources/> <connections/></ui>
MyWizard(){ QWizardPage * pageOne = new QWizardPage; pageOneUi->setupUi( pageOne ); addPage( pageOne );}
#ifndef CREATEPROJECT_H#define CREATEPROJECT_H#include <QWizard>#include <QPushButton>class Step1;class CreateProject : public QWizard{public: CreateProject(QWidget* parent); ~CreateProject();private: Step1 *first; Step1 *second;};class Step1: public QWizardPage{ public: Step1(QWidget* parent); ~Step1(); private: QPushButton *bt;};#endif // CREATEPROJECT_H
#include "createproject.h"CreateProject::CreateProject(QWidget* parent): QWizard(parent){ first = new Step1(this); second = new Step1(this); this->addPage(first); this->addPage(second);}CreateProject::~CreateProject(){ delete first; delete second;}Step1::Step1(QWidget *parent): QWizardPage(parent){ bt = new QPushButton(this); bt->show();}Step1::~Step1(){ delete bt;}