<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- portingcppapps_toqt5.qdoc --> <title>Porting C++ Applications to Qt 5 | QtDoc 5.1</title> <link rel="stylesheet" type="text/css" href="style/offline.css" /> </head> <body> <div class="header" id="qtdocheader"></div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#related-topics">Related topics</a></li> </ul> </div> <h1 class="title">Porting C++ Applications to Qt 5</h1> <span class="subtitle"></span> <!-- $$$portingcppapp.html-description --> <div class="descr"> <a name="details"></a> <p>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:</p> <ol class="1"> <li>Open the Animated Tiles project using Qt Creator.</li> <li>Edit <tt>main.cpp</tt> and replace the <tt>#include <QtGui></tt> instance with <tt>#include <QtWidgets></tt>.</li> <li>Edit the <tt>animatedtiles.pro</tt> and add <tt>QT += widgets</tt> towards the end of the file.<p><b>Note: </b>QtGui is included by default in all Qt applications unless excluded using the <tt>QT -= gui</tt> directive in the <tt>qmake</tt> project file.</p></li> <li>Save the changes and run the application.</li> </ol> <p>Once you see the application running, check whether it behaves as expected.</p> <p class="centerAlign"><img src="images/animatedtiles_snapshot.png" alt=""A snapshot of the \c animatedtiles application running on Ubuntu v12.04"" /></p><p>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:</p> <ol class="1"> <li>Open your project using Qt Creator.</li> <li>Replace all <tt>#include <QtWebKit></tt> instances with <tt>#include <QtWebKitWidgets></tt> in your project source.</li> <li>Edit the <tt>.pro</tt> file and add <tt>QT += webkitwidgets</tt>.<p><b>Note: </b>If the <tt>QT +=</tt> statement already exists, append <tt>webkitwidgets</tt> to it.</p></li> <li>Save changes and run your application.</li> </ol> <a name="related-topics"></a> <h2>Related topics</h2> <ul> <li><a href="sourcebreaks.html">C++ API Changes</a></li> <li><a href="portingqmlapp.html">Porting QML Applications to Qt 5 Example</a></li> <li><a href="qtexamplesandtutorials.html">Qt Examples And Tutorials</a></li> </ul> </div> <!-- @@@portingcppapp.html --> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its subsidiaries. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> </body> </html>