• 【Qt之QWizardPage】使用


    介绍

    QWizardPage类是向导页面的基类。
    QWizard表示一个向导。每个页面都是一个QWizardPage。当创建自己的向导时,可以直接使用QWizardPage,也可以子类化它以获得更多控制。
    页面具有以下属性,由QWizard呈现:a titlea subTitlea set of pixmaps。有关详细信息,请参见向导页面元素。一旦将页面添加到向导中(使用QWizard :: addPage()QWizard :: setPage()),wizard()将返回指向相关的QWizard对象的指针。
    页面提供了五个虚函数,可以重新实现以提供自定义行为:

    • initializePage()在用户单击向导的“下一步”按钮时调用以初始化页面的内容。如果您想从先前页面输入的内容中派生页面的默认值,则应该重新实现此函数。
    • cleanupPage()在用户单击向导的“返回”按钮时调用以重置页面的内容。
    • validatePage()在用户单击Next或Finish时验证页面。如果用户输入了不完整或无效的信息,通常会使用此函数显示错误消息。
    • nextId()返回下一页的ID。它在创建非线性向导时很有用,这些向导允许基于用户提供的信息进行不同的遍历路径。
    • isComplete()用于确定是否应启用或禁用“下一步”和/或“完成”按钮。如果重新实现isComplete(),还必须确保每当完成状态更改时发出completeChanged()。

    通常,向导的“下一步”按钮和“完成”按钮是互斥的。如果isFinalPage()返回true,则可用Finish;否则,可用下一步。默认情况下,isFinalPage()仅在nextId()返回-1时为true。如果要在页面上同时显示“下一步”“完成”(允许用户执行“早期完成”),请在该页面上调用setFinalPage(true)。对于支持早期完成的向导,您可能还想在向导上设置HaveNextButtonOnLastPageHaveFinishButtonOnEarlyPages选项。

    在许多向导中,页面的内容可能会影响后续页面的字段的默认值。为了方便页面之间的通信,QWizard支持“字段”机制,允许您在页面上注册字段(例如QLineEdit)并从任何页面访问其值。字段对整个向导程序是全局的,并使任何单个页面都可以访问存储在另一个页面中的信息,而无需将所有逻辑放入QWizard或页面明确知道彼此。使用registerField()注册字段,可以使用field()setField()随时访问它们。

    常用方法

    1. virtual void initializePage(int id)
      这个虚函数由QWizard::initializePage()调用,以便在页面显示之前对其进行准备,或者由于QWizard::restart()被调用,或者由于用户单击Next而显示页面。(但是,如果设置了QWizard::IndependentPages选项,则仅在第一次显示页面时调用此函数。)
      通过重新实现这个函数,您可以确保页面的字段是基于先前页面中的字段正确初始化的。例如:
    void OutputFilesPage: initializePage ()
    {
    	QString className = field("className").toString();
    	headerLineEdit->setText(className.toLower() + ".h");
    	implementationLineEdit->setText(className.toLower() + ".cpp");
    	outputDirLineEdit - > setText (QDir:: toNativeSeparators (QDir: tempPath ()));
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    默认实现什么都不做。
    2. void setButtonText(QWizard::WizardButton which, const QString &text)
    将按钮上的文本设置为本页上的文本。
    默认情况下,按钮上的文本依赖于QWizard::wizardStyle,但可以使用QWizard::setButtonText()为整个向导重新定义。

    setButtonText(QWizard::NextButton, "hei");
    
    • 1

    在这里插入图片描述
    3. void setCommitPage(bool commitPage)
    如果commitPage为true,则将该页设置为提交页;否则,将其设置为普通页面。
    提交页是表示不能通过单击“返回”或“取消”来撤消的操作的页面。
    提交按钮取代提交页面上的Next按钮。单击此按钮只调用QWizard::next(),就像单击next一样。
    直接从提交页面进入的页面会禁用后退按钮。

    setCommitPage(true);
    
    • 1

    在这里插入图片描述

    1. void setFinalPage(bool finalPage)
      如果finalPage为true,则显式地将此页面设置为final。
      调用setFinalPage(true)后,isFinalPage()返回true, Finish按钮可见(如果isComplete()返回true则启用)。
      调用setFinalPage(false)后,如果nextId()返回-1,isFinalPage()返回true;否则,返回false。

    示例

    .h

    #ifndef CLASSWIZARD_H
    #define CLASSWIZARD_H
    
    #include 
    
    QT_BEGIN_NAMESPACE
    class QCheckBox;
    class QGroupBox;
    class QLabel;
    class QLineEdit;
    class QRadioButton;
    QT_END_NAMESPACE
    
    class ClassWizard : public QWizard
    {
        Q_OBJECT
    
    public:
        ClassWizard(QWidget *parent = 0);
    
        void accept() override;
    };
    
    class IntroPage : public QWizardPage
    {
        Q_OBJECT
    
    public:
        IntroPage(QWidget *parent = 0);
    
    private:
        QLabel *label;
    };
    
    class ClassInfoPage : public QWizardPage
    {
        Q_OBJECT
    
    public:
        ClassInfoPage(QWidget *parent = 0);
    
    private:
        QLabel *classNameLabel;
        QLabel *baseClassLabel;
        QLineEdit *classNameLineEdit;
        QLineEdit *baseClassLineEdit;
        QCheckBox *qobjectMacroCheckBox;
        QGroupBox *groupBox;
        QRadioButton *qobjectCtorRadioButton;
        QRadioButton *qwidgetCtorRadioButton;
        QRadioButton *defaultCtorRadioButton;
        QCheckBox *copyCtorCheckBox;
    };
    
    class CodeStylePage : public QWizardPage
    {
        Q_OBJECT
    
    public:
        CodeStylePage(QWidget *parent = 0);
    
    protected:
        void initializePage() override;
    
    private:
        QCheckBox *commentCheckBox;
        QCheckBox *protectCheckBox;
        QCheckBox *includeBaseCheckBox;
        QLabel *macroNameLabel;
        QLabel *baseIncludeLabel;
        QLineEdit *macroNameLineEdit;
        QLineEdit *baseIncludeLineEdit;
    };
    
    class OutputFilesPage : public QWizardPage
    {
        Q_OBJECT
    
    public:
        OutputFilesPage(QWidget *parent = 0);
    
    protected:
        void initializePage() override;
    
    private:
        QLabel *outputDirLabel;
        QLabel *headerLabel;
        QLabel *implementationLabel;
        QLineEdit *outputDirLineEdit;
        QLineEdit *headerLineEdit;
        QLineEdit *implementationLineEdit;
    };
    
    class ConclusionPage : public QWizardPage
    {
        Q_OBJECT
    
    public:
        ConclusionPage(QWidget *parent = 0);
    
    protected:
        void initializePage() override;
    
    private:
        QLabel *label;
    };
    
    #endif
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109

    .cpp

    #include 
    
    #include "classwizard.h"
    
    ClassWizard::ClassWizard(QWidget *parent)
        : QWizard(parent)
    {
        addPage(new IntroPage);
        addPage(new ClassInfoPage);
        addPage(new CodeStylePage);
        addPage(new OutputFilesPage);
        addPage(new ConclusionPage);
    
        setPixmap(QWizard::BannerPixmap, QPixmap(":/images/banner.png"));
        setPixmap(QWizard::BackgroundPixmap, QPixmap(":/images/background.png"));
    
        setWindowTitle(tr("Class Wizard"));
    }
    
    void ClassWizard::accept()
    {
        QByteArray className = field("className").toByteArray();
        QByteArray baseClass = field("baseClass").toByteArray();
        QByteArray macroName = field("macroName").toByteArray();
        QByteArray baseInclude = field("baseInclude").toByteArray();
    
        QString outputDir = field("outputDir").toString();
        QString header = field("header").toString();
        QString implementation = field("implementation").toString();
    
        QByteArray block;
    
        if (field("comment").toBool()) {
            block += "/*\n";
            block += "    " + header.toLatin1() + '\n';
            block += "*/\n";
            block += '\n';
        }
        if (field("protect").toBool()) {
            block += "#ifndef " + macroName + '\n';
            block += "#define " + macroName + '\n';
            block += '\n';
        }
        if (field("includeBase").toBool()) {
            block += "#include " + baseInclude + '\n';
            block += '\n';
        }
    
        block += "class " + className;
        if (!baseClass.isEmpty())
            block += " : public " + baseClass;
        block += '\n';
        block += "{\n";
    
        /* qmake ignore Q_OBJECT */
    
        if (field("qobjectMacro").toBool()) {
            block += "    Q_OBJECT\n";
            block += '\n';
        }
        block += "public:\n";
    
        if (field("qobjectCtor").toBool()) {
            block += "    " + className + "(QObject *parent = 0);\n";
        } else if (field("qwidgetCtor").toBool()) {
            block += "    " + className + "(QWidget *parent = 0);\n";
        } else if (field("defaultCtor").toBool()) {
            block += "    " + className + "();\n";
            if (field("copyCtor").toBool()) {
                block += "    " + className + "(const " + className + " &other);\n";
                block += '\n';
                block += "    " + className + " &operator=" + "(const " + className
                         + " &other);\n";
            }
        }
        block += "};\n";
    
        if (field("protect").toBool()) {
            block += '\n';
            block += "#endif\n";
        }
    
        QFile headerFile(outputDir + '/' + header);
        if (!headerFile.open(QFile::WriteOnly | QFile::Text)) {
            QMessageBox::warning(0, QObject::tr("Simple Wizard"),
                                 QObject::tr("Cannot write file %1:\n%2")
                                 .arg(headerFile.fileName())
                                 .arg(headerFile.errorString()));
            return;
        }
        headerFile.write(block);
    
        block.clear();
    
        if (field("comment").toBool()) {
            block += "/*\n";
            block += "    " + implementation.toLatin1() + '\n';
            block += "*/\n";
            block += '\n';
        }
        block += "#include \"" + header.toLatin1() + "\"\n";
        block += '\n';
    
        if (field("qobjectCtor").toBool()) {
            block += className + "::" + className + "(QObject *parent)\n";
            block += "    : " + baseClass + "(parent)\n";
            block += "{\n";
            block += "}\n";
        } else if (field("qwidgetCtor").toBool()) {
            block += className + "::" + className + "(QWidget *parent)\n";
            block += "    : " + baseClass + "(parent)\n";
            block += "{\n";
            block += "}\n";
        } else if (field("defaultCtor").toBool()) {
            block += className + "::" + className + "()\n";
            block += "{\n";
            block += "    // missing code\n";
            block += "}\n";
    
            if (field("copyCtor").toBool()) {
                block += "\n";
                block += className + "::" + className + "(const " + className
                         + " &other)\n";
                block += "{\n";
                block += "    *this = other;\n";
                block += "}\n";
                block += '\n';
                block += className + " &" + className + "::operator=(const "
                         + className + " &other)\n";
                block += "{\n";
                if (!baseClass.isEmpty())
                    block += "    " + baseClass + "::operator=(other);\n";
                block += "    // missing code\n";
                block += "    return *this;\n";
                block += "}\n";
            }
        }
    
        QFile implementationFile(outputDir + '/' + implementation);
        if (!implementationFile.open(QFile::WriteOnly | QFile::Text)) {
            QMessageBox::warning(0, QObject::tr("Simple Wizard"),
                                 QObject::tr("Cannot write file %1:\n%2")
                                 .arg(implementationFile.fileName())
                                 .arg(implementationFile.errorString()));
            return;
        }
        implementationFile.write(block);
    
        QDialog::accept();
    }
    
    IntroPage::IntroPage(QWidget *parent)
        : QWizardPage(parent)
    {
        setTitle(tr("Introduction"));
        setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark1.png"));
    
        label = new QLabel(tr("This wizard will generate a skeleton C++ class "
                              "definition, including a few functions. You simply "
                              "need to specify the class name and set a few "
                              "options to produce a header file and an "
                              "implementation file for your new C++ class."));
        label->setWordWrap(true);
    
        QVBoxLayout *layout = new QVBoxLayout;
        layout->addWidget(label);
        setLayout(layout);
    }
    
    ClassInfoPage::ClassInfoPage(QWidget *parent)
        : QWizardPage(parent)
    {
        setTitle(tr("Class Information"));
        setSubTitle(tr("Specify basic information about the class for which you "
                       "want to generate skeleton source code files."));
        setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo1.png"));
    
        classNameLabel = new QLabel(tr("&Class name:"));
        classNameLineEdit = new QLineEdit;
        classNameLabel->setBuddy(classNameLineEdit);
    
        baseClassLabel = new QLabel(tr("B&ase class:"));
        baseClassLineEdit = new QLineEdit;
        baseClassLabel->setBuddy(baseClassLineEdit);
    
        qobjectMacroCheckBox = new QCheckBox(tr("Generate Q_OBJECT ¯o"));
    
        groupBox = new QGroupBox(tr("C&onstructor"));
    
        qobjectCtorRadioButton = new QRadioButton(tr("&QObject-style constructor"));
        qwidgetCtorRadioButton = new QRadioButton(tr("Q&Widget-style constructor"));
        defaultCtorRadioButton = new QRadioButton(tr("&Default constructor"));
        copyCtorCheckBox = new QCheckBox(tr("&Generate copy constructor and "
                                            "operator="));
    
        defaultCtorRadioButton->setChecked(true);
    
        connect(defaultCtorRadioButton, &QAbstractButton::toggled,
                copyCtorCheckBox, &QWidget::setEnabled);
    
        registerField("className*", classNameLineEdit);
        registerField("baseClass", baseClassLineEdit);
        registerField("qobjectMacro", qobjectMacroCheckBox);
    
        registerField("qobjectCtor", qobjectCtorRadioButton);
        registerField("qwidgetCtor", qwidgetCtorRadioButton);
        registerField("defaultCtor", defaultCtorRadioButton);
        registerField("copyCtor", copyCtorCheckBox);
    
        QVBoxLayout *groupBoxLayout = new QVBoxLayout;
    
        groupBoxLayout->addWidget(qobjectCtorRadioButton);
        groupBoxLayout->addWidget(qwidgetCtorRadioButton);
        groupBoxLayout->addWidget(defaultCtorRadioButton);
        groupBoxLayout->addWidget(copyCtorCheckBox);
        groupBox->setLayout(groupBoxLayout);
    
        QGridLayout *layout = new QGridLayout;
        layout->addWidget(classNameLabel, 0, 0);
        layout->addWidget(classNameLineEdit, 0, 1);
        layout->addWidget(baseClassLabel, 1, 0);
        layout->addWidget(baseClassLineEdit, 1, 1);
        layout->addWidget(qobjectMacroCheckBox, 2, 0, 1, 2);
        layout->addWidget(groupBox, 3, 0, 1, 2);
        setLayout(layout);
    }
    
    CodeStylePage::CodeStylePage(QWidget *parent)
        : QWizardPage(parent)
    {
        setTitle(tr("Code Style Options"));
        setSubTitle(tr("Choose the formatting of the generated code."));
        setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo2.png"));
    
        commentCheckBox = new QCheckBox(tr("&Start generated files with a "
    
                                           "comment"));
        commentCheckBox->setChecked(true);
    
        protectCheckBox = new QCheckBox(tr("&Protect header file against multiple "
                                           "inclusions"));
        protectCheckBox->setChecked(true);
    
        macroNameLabel = new QLabel(tr("&Macro name:"));
        macroNameLineEdit = new QLineEdit;
        macroNameLabel->setBuddy(macroNameLineEdit);
    
        includeBaseCheckBox = new QCheckBox(tr("&Include base class definition"));
        baseIncludeLabel = new QLabel(tr("Base class include:"));
        baseIncludeLineEdit = new QLineEdit;
        baseIncludeLabel->setBuddy(baseIncludeLineEdit);
    
        connect(protectCheckBox, &QAbstractButton::toggled,
                macroNameLabel, &QWidget::setEnabled);
        connect(protectCheckBox, &QAbstractButton::toggled,
                macroNameLineEdit, &QWidget::setEnabled);
        connect(includeBaseCheckBox, &QAbstractButton::toggled,
                baseIncludeLabel, &QWidget::setEnabled);
        connect(includeBaseCheckBox, &QAbstractButton::toggled,
                baseIncludeLineEdit, &QWidget::setEnabled);
    
        registerField("comment", commentCheckBox);
        registerField("protect", protectCheckBox);
        registerField("macroName", macroNameLineEdit);
        registerField("includeBase", includeBaseCheckBox);
        registerField("baseInclude", baseIncludeLineEdit);
    
        QGridLayout *layout = new QGridLayout;
        layout->setColumnMinimumWidth(0, 20);
        layout->addWidget(commentCheckBox, 0, 0, 1, 3);
        layout->addWidget(protectCheckBox, 1, 0, 1, 3);
        layout->addWidget(macroNameLabel, 2, 1);
        layout->addWidget(macroNameLineEdit, 2, 2);
        layout->addWidget(includeBaseCheckBox, 3, 0, 1, 3);
        layout->addWidget(baseIncludeLabel, 4, 1);
        layout->addWidget(baseIncludeLineEdit, 4, 2);
    
        setLayout(layout);
    }
    
    void CodeStylePage::initializePage()
    {
        QString className = field("className").toString();
        macroNameLineEdit->setText(className.toUpper() + "_H");
    
        QString baseClass = field("baseClass").toString();
    
        includeBaseCheckBox->setChecked(!baseClass.isEmpty());
        includeBaseCheckBox->setEnabled(!baseClass.isEmpty());
        baseIncludeLabel->setEnabled(!baseClass.isEmpty());
        baseIncludeLineEdit->setEnabled(!baseClass.isEmpty());
    
        QRegularExpression rx("Q[A-Z].*");
        if (baseClass.isEmpty()) {
            baseIncludeLineEdit->clear();
        } else if (rx.match(baseClass).hasMatch()) {
            baseIncludeLineEdit->setText('<' + baseClass + '>');
        } else {
            baseIncludeLineEdit->setText('"' + baseClass.toLower() + ".h\"");
        }
    }
    
    OutputFilesPage::OutputFilesPage(QWidget *parent)
        : QWizardPage(parent)
    {
        setTitle(tr("Output Files"));
        setSubTitle(tr("Specify where you want the wizard to put the generated "
                       "skeleton code."));
        setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo3.png"));
    
        outputDirLabel = new QLabel(tr("&Output directory:"));
        outputDirLineEdit = new QLineEdit;
        outputDirLabel->setBuddy(outputDirLineEdit);
    
        headerLabel = new QLabel(tr("&Header file name:"));
        headerLineEdit = new QLineEdit;
        headerLabel->setBuddy(headerLineEdit);
    
        implementationLabel = new QLabel(tr("&Implementation file name:"));
        implementationLineEdit = new QLineEdit;
        implementationLabel->setBuddy(implementationLineEdit);
    
        registerField("outputDir*", outputDirLineEdit);
        registerField("header*", headerLineEdit);
        registerField("implementation*", implementationLineEdit);
    
        QGridLayout *layout = new QGridLayout;
        layout->addWidget(outputDirLabel, 0, 0);
        layout->addWidget(outputDirLineEdit, 0, 1);
        layout->addWidget(headerLabel, 1, 0);
        layout->addWidget(headerLineEdit, 1, 1);
        layout->addWidget(implementationLabel, 2, 0);
        layout->addWidget(implementationLineEdit, 2, 1);
        setLayout(layout);
    }
    
    void OutputFilesPage::initializePage()
    {
        QString className = field("className").toString();
        headerLineEdit->setText(className.toLower() + ".h");
        implementationLineEdit->setText(className.toLower() + ".cpp");
        outputDirLineEdit->setText(QDir::toNativeSeparators(QDir::tempPath()));
    }
    
    ConclusionPage::ConclusionPage(QWidget *parent)
        : QWizardPage(parent)
    {
        setTitle(tr("Conclusion"));
        setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark2.png"));
    
        label = new QLabel;
        label->setWordWrap(true);
    
        QVBoxLayout *layout = new QVBoxLayout;
        layout->addWidget(label);
        setLayout(layout);
    }
    
    void ConclusionPage::initializePage()
    {
        QString finishText = wizard()->buttonText(QWizard::FinishButton);
        finishText.remove('&');
        label->setText(tr("Click %1 to generate the class skeleton.")
         
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364

    .main

    #include 
    #include 
    #include 
    #include 
    
    #include "classwizard.h"
    
    int main(int argc, char *argv[])
    {
        Q_INIT_RESOURCE(classwizard);
    
        QApplication app(argc, argv);
    
    #ifndef QT_NO_TRANSLATION
        QString translatorFileName = QLatin1String("qt_");
        translatorFileName += QLocale::system().name();
        QTranslator *translator = new QTranslator(&app);
        if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
            app.installTranslator(translator);
    #endif
    
        ClassWizard wizard;
        wizard.show();
        return app.exec();
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
  • 相关阅读:
    PsiQuantum宣布在容错量子计算架构方面取得新突破
    JavaScript 中的构造函数与原型:有什么区别?
    各种信息论坛
    cmd和PyCharm如何调用电脑中有多个版本Python
    Linux 文件读写
    【每日一题Day45】LC1769移动所有球到每个盒子所需要的最小操作数 | 模拟 贡献
    3.1依赖注入
    JG/T 543-2018 铝塑共挤门窗检测
    2022.8.26小结 ABAP 语法记录
    【Java挑战赛】——static、代码块
  • 原文地址:https://blog.csdn.net/MrHHHHHH/article/details/134401093