Source

Target

Commits (3)
Showing with 34 additions and 29 deletions
......@@ -30,6 +30,7 @@ depends += \
qtqml \
qtquick \
qtquickcontrols \
qtquickcontrolsstyles \
qtquickdialogs \
qtquicklayouts \
qtscript \
......
......@@ -29,36 +29,42 @@
\title Porting C++ Applications to Qt 5
\brief Provides instructions to migrate a Qt 4 C++ application to Qt 5.
This topic talks about the Qt Widgets change and provides guidance to handle it.
The following step-by-step instructions takes you through the changes required
to port the \l{Animated Tiles Example}{Animated Tiles} C++ application to Qt 5:
This topic talks about the Qt Widgets and Qt WebKit changes in Qt 5. The
following step-by-step instructions take you through the changes required to
port the \l{Animated Tiles Example}{Animated Tiles} application to Qt 5:
\list 1
\li Edit \c {main.cpp} and change the \c {#include <QtGui>} to \c {#include <QtWidgets>}.
\note You can find a perl script called fixqt4headers in the bin directory of your Qt package that will
automate many of the required header file changes.
\li Edit the \c {animatedtiles.pro} and add \c {QT += widgets} towards the end of the file.
\li Open the Animated Tiles project using Qt Creator.
\li Edit \c {main.cpp} and replace the \c {#include <QtGui>} instance with
\c {#include <QtWidgets>}.
\li Edit the \c {animatedtiles.pro} and add \c {QT += widgets} towards the
end of the file.
\note QtGui is included by default in all Qt applications unless excluded using the \c {QT -= gui} directive in the \c{qmake} project file.
\li Run qmake and make utilities to build the binary.
\li Save the changes and run the application.
\endlist
This creates the \c animatedtiles executable. Try running the executable to see if the application behaves as expected.
Once you see the application running, check whether it behaves as expected.
\image animatedtiles_snapshot.png "A snapshot of the \c animatedtiles application running on Ubuntu v12.04"
A similar change is needed for porting Qt 4 applications using Qt WebKit to Qt 5. The following
A similar change is needed to port Qt 4 C++ applications using Qt WebKit. The following
step-by-step instructions take you through the changes required to achieve this:
\list 1
\li If using \c {#include <QtWebKit>}, add \c {#include <QtWebKitWidgets} in your source code.
\li Edit the pro file and add \c {QT += webkitwidgets} towards the end of the file.
\li Run qmake and make utilities to build the binary.
\li Open your project using Qt Creator.
\li Replace all \c {#include <QtWebKit>} instances with
\c {#include <QtWebKitWidgets>} in your project source.
\li Edit the \c{.pro} file and add \c {QT += webkitwidgets}.
\note If the \c {QT +=} statement already exists, append \c webkitwidgets
to it.
\li Save changes and run your application.
\endlist
\section1 Related topics
\list
\li \l {API Changes}
\li \l {C++ API Changes}
\li \l {Porting QML Applications to Qt 5 Example}
\li \l {QML Examples and Demos}
\li \l {Qt Examples And Tutorials}
\endlist
*/
......@@ -38,17 +38,19 @@ QML demo work on Qt 5. If you have the SDK based on Qt 4.8 installed, you can
find this demo application under
\c{<install_dir_root>/Examples/4.x/declarative/demos/}.
The \c{flickr} application is a complete application that comes with a launcher.
Follow these step-by-step instructions to make the \e{flickr} Qt 4 QML
application work on Qt 5:
Follow these step-by-step instructions to port the \e{flickr} Qt 4 QML
application work to Qt 5:
\list 1
\li Edit all the \c{.qml} files and replace \c{import QtQuick 1.0} statements
\li Open the \e{flickr} project using Qt Creator.
\li Edit all the \c{.qml} files and replace the \c{import QtQuick 1.0} statements
with \c{import QtQuick 2.0}.
\li Add the additional \c{import QtQuick.XmlListModel 2.0} statement to
\c{qml/common/RssModel.qml}.
\note XmlListModel is part of a submodule under QtQuick and it must be
imported explicitly to use it.
\note \l{Qt Quick XmlListModel QML Types}{XmlListModel} is part of a
submodule under \l{QtQuick} and it must be imported explicitly in order
to use it.
\li Make the following changes to
\c{qmlapplicationviewer/qmlapplicationviewer.h}:
\list
......@@ -80,12 +82,10 @@ application work on Qt 5:
\li Remove the code between \c{#if QT_VERSION < 0x040702} and \c{#else}, and
\c{#endif // QT_VERSION < 0x040702} macros towards the end.
\endlist
\li Run the \c{qmake} and \c{make} utilities to build the application.
\note Ensure that the \c{PATH} environment variable is pointing to the
Qt 5 binaries and libraries directories, before running \c{qmake}.
\li Save changes to the project and run the application.
\endlist
Run the \c{flickr} application to see whether it behaves as expected. Here is a
Once you see the application running, check whether it behaves as expected. Here is a
snapshot of the application running on Ubuntu v12.04:
\image flickr_application.png
......
......@@ -69,9 +69,7 @@ and shader effects.
\section2 Graphical Controls
The \l{Qt Quick Controls} module is new in Qt 5.1 and provides a
set of UI elements to create classic desktop-style user interfaces using \l{Qt Quick} 2.
While the module is not mature yet, it already offers useable featured controls
styled for the desktop. See \l{Qt Quick Controls} for more information.
set of UI elements to create user interfaces using \l{Qt Quick} 2.
For more about how to create application user interfaces with QML, visit the
\l{QML User Interfaces} page.
......