1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
6 | **
|
---|
7 | ** This file is part of the documentation of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:FDL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in a
|
---|
14 | ** written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Free Documentation License
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Free
|
---|
18 | ** Documentation License version 1.3 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file included in the packaging of this
|
---|
20 | ** file.
|
---|
21 | **
|
---|
22 | ** If you have questions regarding the use of this file, please contact
|
---|
23 | ** Nokia at qt-info@nokia.com.
|
---|
24 | ** $QT_END_LICENSE$
|
---|
25 | **
|
---|
26 | ****************************************************************************/
|
---|
27 |
|
---|
28 | /*!
|
---|
29 | \page qt3to4.html
|
---|
30 | \title qt3to4 - The Qt 3 to 4 Porting Tool
|
---|
31 |
|
---|
32 | \ingroup porting
|
---|
33 | \keyword qt3to4
|
---|
34 |
|
---|
35 | The \c qt3to4 tool provides help when moving a project from Qt 3
|
---|
36 | to Qt 4. It is designed to automate the most tedious part of the
|
---|
37 | porting effort.
|
---|
38 |
|
---|
39 | See \l{Porting to Qt 4} and \l{Porting UI Files to Qt 4} for
|
---|
40 | more information about porting Qt 3 applications to Qt 4.
|
---|
41 |
|
---|
42 | \section1 Usage
|
---|
43 |
|
---|
44 | \c qt3to4 can be run either on individual C++ source or header
|
---|
45 | files, or on an entire project specified by a \c qmake \c .pro
|
---|
46 | file:
|
---|
47 |
|
---|
48 | \snippet doc/src/snippets/code/doc_src_qt3to4.qdoc 0
|
---|
49 |
|
---|
50 | In project mode, \c qt3to4 reads the \c .pro file and converts
|
---|
51 | all files specified in it. The tool modifies the files in place.
|
---|
52 | You might want to make a copy of your project before you run the
|
---|
53 | tool.
|
---|
54 |
|
---|
55 | \section1 Porting Rules
|
---|
56 |
|
---|
57 | The Qt porting tool loads its porting rules from an XML file
|
---|
58 | called \c q3porting.xml located in Qt's \c tools/porting/src directory.
|
---|
59 | By editing this file, you can add your own rules or remove some
|
---|
60 | rules.
|
---|
61 |
|
---|
62 | The standard \c q3porting.xml file specifies the following
|
---|
63 | conversions:
|
---|
64 |
|
---|
65 | \list
|
---|
66 | \o Rename classes that are now part of the Qt 3 support
|
---|
67 | library (e.g., replace \c QFileDialog with \c{Q3FileDialog}).
|
---|
68 | \o Prefix or rename enum values that have been moved or
|
---|
69 | renamed (e.g., replace \c QButton::On with \c{QCheckBox::On}) or
|
---|
70 | members of the Qt namespace (e.g., replace \c QWidget::red with
|
---|
71 | \c{Qt::red}).
|
---|
72 | \o Add \c #include directives that might be needed in Qt 4.
|
---|
73 | \endlist
|
---|
74 |
|
---|
75 | \section2 Location of the qt3porting.xml File
|
---|
76 |
|
---|
77 | You can now specify the location of the \c qt3porting.xml file with the
|
---|
78 | \c{-f} command line option. This is useful if you want to use a modified
|
---|
79 | file with your own rules.
|
---|
80 |
|
---|
81 | If you you don't want to maintain a modified \c qt3porting.xml it is
|
---|
82 | possible to create a "patch" file that includes the original file and adds
|
---|
83 | or disables rules. The syntax for this file looks like this:
|
---|
84 |
|
---|
85 | \snippet doc/src/snippets/code/doc_src_qt3to4.qdoc 1
|
---|
86 |
|
---|
87 | \section1 Logging
|
---|
88 |
|
---|
89 | The porting tool logs all changes to a file called \c
|
---|
90 | portinglog.txt in the current directory. This file lists all
|
---|
91 | changes made to the source files.
|
---|
92 |
|
---|
93 | \section1 Advanced Usage
|
---|
94 |
|
---|
95 | When porting, \c qt3to4 parses the source files and ports the
|
---|
96 | contents according to the C++ language rules. This C++ parsing
|
---|
97 | step can be disabled with the \c -disableCppParsing option.
|
---|
98 |
|
---|
99 | If C++ parsing is enabled, \c qt3to4 must be able to locate the
|
---|
100 | headers included from the source files. Necessary headers include
|
---|
101 | the public Qt headers and any headers that declares names that
|
---|
102 | may conflict with names in the public Qt headers. The standard
|
---|
103 | C++ headers and system headers are usually not needed.
|
---|
104 |
|
---|
105 | You can tell \c qt3to4 where to look for headers by using the
|
---|
106 | \c{-I} command-line option. Qt 3.3 header information is built
|
---|
107 | in, so it is normaly not necessary to specify the location of the
|
---|
108 | Qt headers. If you are porting from a different version of Qt 3,
|
---|
109 | you may want to disable the built-in headers with
|
---|
110 | \c{-disableBuiltInQt3Headers}, and then add the path to the
|
---|
111 | actual headers with the \c{-I} option.
|
---|
112 |
|
---|
113 | When porting a project, \c qt3to4 will read the \c INCLUDEPATH
|
---|
114 | and \c DEPENDPATH variables from the \c .pro file and add the
|
---|
115 | paths specified here to the list of include search directories.
|
---|
116 |
|
---|
117 | To see which headers that are not found, use the \c{-missingFileWarnings}
|
---|
118 | option.
|
---|
119 |
|
---|
120 | \section1 Limitations
|
---|
121 |
|
---|
122 | In some cases, you might get compiler errors because of identifiers
|
---|
123 | in the global namespace (e.g., \c CTRL). Adding
|
---|
124 |
|
---|
125 | \snippet doc/src/snippets/code/doc_src_qt3to4.qdoc 2
|
---|
126 |
|
---|
127 | at the beginning of the source file that contains
|
---|
128 | the indentifier solves the problem.
|
---|
129 |
|
---|
130 | \section1 Legal Notices
|
---|
131 |
|
---|
132 | Some source code in \c qt3to4 is licensed under specific highly
|
---|
133 | permissive licenses from the original authors. Nokia gratefully
|
---|
134 | acknowledges these contributions to \c qt3to4 and all uses of
|
---|
135 | \c qt3to4 should also acknowledge these contributions and quote the
|
---|
136 | following license statements in an appendix to the documentation.
|
---|
137 |
|
---|
138 | \list
|
---|
139 | \o \l{Contributions to the Following qt3to4 Files: treewalker.h,
|
---|
140 | treedump.cpp, treedump.h, treewalker.cpp}
|
---|
141 | \endlist
|
---|
142 | */
|
---|
143 |
|
---|
144 | /*!
|
---|
145 | \page qt3to4-treewalker.html
|
---|
146 | \title Contributions to the Following qt3to4 Files: treewalker.h, treedump.cpp, treedump.h, treewalker.cpp
|
---|
147 | \ingroup licensing
|
---|
148 | \brief License information for contributions to the qt3to4 source code.
|
---|
149 |
|
---|
150 | \legalese
|
---|
151 | Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). \BR
|
---|
152 | Copyright (C) 2005 Roberto Raggi
|
---|
153 |
|
---|
154 | Permission is hereby granted, free of charge, to any person obtaining
|
---|
155 | a copy of this software and associated documentation files (the
|
---|
156 | "Software"), to deal in the Software without restriction, including
|
---|
157 | without limitation the rights to use, modify, market, reproduce,
|
---|
158 | grant sublicenses and distribute subject to the following
|
---|
159 | conditions: The above copyright notice and this permission notice
|
---|
160 | shall be included in all copies or substantial portions of the
|
---|
161 | Software. These files are provided AS IS with NO WARRANTY OF ANY
|
---|
162 | KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTIBILITY AND FITNESS
|
---|
163 | FOR A PARTICULAR PURPOSE.
|
---|
164 | \endlegalese
|
---|
165 | */
|
---|