# Qt5中的QtGui

  1 /****************************************************************************
2  **
3  ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4  ** Contact: http://www.qt-project.org/legal
5  **
6  ** This file is part of the examples of the Qt Toolkit.
7  **
8  ** $QT_BEGIN_LICENSE:BSD$
9  ** You may use this file under the terms of the BSD license as follows:
10  **
11  ** "Redistribution and use in source and binary forms, with or without
12  ** modification, are permitted provided that the following conditions are
13  ** met:
14  **   * Redistributions of source code must retain the above copyright
15  **     notice, this list of conditions and the following disclaimer.
16  **   * Redistributions in binary form must reproduce the above copyright
17  **     notice, this list of conditions and the following disclaimer in
18  **     the documentation and/or other materials provided with the
19  **     distribution.
20  **   * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21  **     of its contributors may be used to endorse or promote products derived
22  **     from this software without specific prior written permission.
23  **
24  **
25  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36  **
37  ** $QT_END_LICENSE$
38  **
39  ****************************************************************************/
40
41 #include <QtWidgets>
42 #include <QTranslator>
43 #include <QLocale>
44 #include <QLibraryInfo>
45
46
47  QWizardPage *createIntroPage()
48  {
49      QWizardPage *page = new QWizardPage;
50      page->setTitle("Introduction");
51
53                                 "of Super Product Two.");
54      label->setWordWrap(true);
55
56      QVBoxLayout *layout = new QVBoxLayout;
58      page->setLayout(layout);
59
60      return page;
61  }
62
63  QWizardPage *createRegistrationPage()
64  {
65      QWizardPage *page = new QWizardPage;
66      page->setTitle("Registration");
68
69      QLabel *nameLabel = new QLabel("Name:");
70      QLineEdit *nameLineEdit = new QLineEdit;
71
72      QLabel *emailLabel = new QLabel("Email address:");
73      QLineEdit *emailLineEdit = new QLineEdit;
74
75      QGridLayout *layout = new QGridLayout;
80      page->setLayout(layout);
81
82      return page;
83  }
84
85  QWizardPage *createConclusionPage()
86  {
87      QWizardPage *page = new QWizardPage;
88      page->setTitle("Conclusion");
89
90      QLabel *label = new QLabel("You are now successfully registered. Have a "
91                                 "nice day!");
92      label->setWordWrap(true);
93
94      QVBoxLayout *layout = new QVBoxLayout;
96      page->setLayout(layout);
97
98      return page;
99  }
100
101  int main(int argc, char *argv[])
102  {
103      QApplication app(argc, argv);
104
105      QString translatorFileName = QLatin1String("qt_");
106      translatorFileName += QLocale::system().name();
107      QTranslator *translator = new QTranslator(&app);
109          app.installTranslator(translator);
110
111      QWizard wizard;
115
116      wizard.setWindowTitle("Trivial Wizard");
117  #ifdef Q_OS_SYMBIAN
118      wizard.showMaximized();
119  #else
120      wizard.show();
121  #endif
122
123      return app.exec();
124  }

11-03 2万+
06-21 4452
05-17 8438
01-14
05-30 4393
02-28 8480
03-19 19
06-05 3096
03-30 1911
04-18 168
01-08