summaryrefslogtreecommitdiff
path: root/doc/src/portingcppapps_toqt5.qdoc
blob: e6ea08aa9b64bd1e26f1a149370af192b632667f (plain)
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
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.  Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page portingcppapp.html
\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:

\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.
       \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.
\endlist

This creates the \c animatedtiles executable. Try running the executable to see if the application 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
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.
\endlist

\section1 Related topics
\list
\li \l {API Changes}
\li \l {Porting QML Applications to Qt 5 Example}
\li \l {QML Examples and Demos}
\endlist
*/