Porting C++ Applications 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 Animated Tiles application to Qt 5:

  1. Open the Animated Tiles project using Qt Creator.
  2. Edit main.cpp and replace the #include <QtGui> instance with #include <QtWidgets>.
  3. Edit the animatedtiles.pro and add QT += widgets towards the end of the file.

    Note: Qt GUI is included by default in all Qt applications unless excluded using the QT -= gui directive in the qmake project file.

  4. Save the changes and run the application.

Once you see the application running, check whether it behaves as expected.

"A snapshot of the \c animatedtiles application running on Ubuntu v12.04"

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:

  1. Open your project using Qt Creator.
  2. Replace all #include <QtWebKit> instances with #include <QtWebKitWidgets> in your project source.
  3. Edit the .pro file and add QT += webkitwidgets.

    Note: If the QT += statement already exists, append webkitwidgets to it.

  4. Save changes and run your application.

© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.