qt3to4 - The Qt 3 to 4 Porting Tool
The qt3to4 tool provides help when moving a project from Qt 3 to Qt 4. It is designed to automate the most tedious part of the porting effort. See Porting to Qt 4 and Porting .ui Files to Qt 4 for more information about porting Qt 3 applications to Qt 4. Usageqt3to4 can be run either on individual C++ source or header files, or on an entire project specified by a qmake .pro file: qt3to4 myfile.cpp qt3to4 myapp.pro In project mode, qt3to4 reads the .pro file and converts all files specified in it. The tool modifies the files in place. You might want to make a copy of your project before you run the tool. Porting RulesThe Qt porting tool loads its porting rules from an XML file called q3porting.xml located in Qt's tools/porting/src directory. By editing this file, you can add your own rules or remove some rules. The standard q3porting.xml file specifies the following conversions:
Location of the qt3porting.xml FileYou can now specify the location of the qt3porting.xml file with the -f command line option. This is useful if you want to use a modified file with your own rules. If you you don't want to maintain a modified qt3porting.xml it is possible to create a "patch" file that includes the original file and adds or disables rules. The syntax for this file looks like this: <Rules> <Include>/path/to/q3porting.xml</Include> <item Type="RenamedHeader" Disable="True" > <Qt4>q3sqlselectcursor.h</Qt4> <Qt3>qsqlselectcursor.h</Qt3> </item> <item Type="RenamedHeader" > <Qt4>newclass.h</Qt4> <Qt3>oldclass.h</Qt3> </item> </Rules> LoggingThe porting tool logs all changes to a file called portinglog.txt in the current directory. This file lists all changes made to the source files. Advanced UsageWhen porting, qt3to4 parses the source files and ports the contents according to the C++ language rules. This C++ parsing step can be disabled with the -disableCppParsing option. If C++ parsing is enabled, qt3to4 must be able to locate the headers included from the source files. Necessary headers include the public Qt headers and any headers that declares names that may conflict with names in the public Qt headers. The standard C++ headers and system headers are usually not needed. You can tell qt3to4 where to look for headers by using the -I command-line option. Qt 3.3 header information is built in, so it is normaly not necessary to specify the location of the Qt headers. If you are porting from a different version of Qt 3, you may want to disable the built-in headers with -disableBuiltInQt3Headers, and then add the path to the actual headers with the -I option. When porting a project, qt3to4 will read the INCLUDEPATH and DEPENDPATH variables from the .pro file and add the paths specified here to the list of include search directories. To see which headers that are not found, use the -missingFileWarnings option. LimitationsIn some cases, you might get compiler errors because of identifiers in the global namespace (e.g., CTRL). Adding using namespace Qt; at the beginning of the source file that contains the indentifier solves the problem. Legal NoticesSome source code in qt3to4 is licensed under specific highly permissive licenses from the original authors. Trolltech gratefully acknowledges these contributions to qt3to4 and all uses of qt3to4 should also acknowledge these contributions and quote the following license statements in an appendix to the documentation. |
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.3 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com