Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 5ab010e37991249ab4adaa24d6e39c6e > files > 158

qt5-qtdoc-5.1.1-2.fc18.noarch.rpm

<?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" />
<!-- portingqmlapp.qdoc -->
  <title>Porting QML Applications to Qt 5 Example | 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 QML Applications to Qt 5 Example</h1>
<span class="subtitle"></span>
<!-- $$$portingqmlapp.html-description -->
<div class="descr"> <a name="details"></a>
<p>The new version of Qt Quick in Qt 5 brings in some changes to the way QML applications are developed. For the complete list of changes that affect existing QML applications, refer to <a href="qtquick-porting-qt5.html">Porting QML Applications to Qt 5</a>.</p>
<p>This topic will walk through the porting process to make the <tt>flickr</tt> Qt 4 QML demo work on Qt 5. If you have the SDK based on Qt 4.8 installed, you can find this demo application under <tt>&lt;install_dir_root&gt;/Examples/4.x/declarative/demos/</tt>.</p>
<p>Follow these step-by-step instructions to port the <i>flickr</i> Qt 4 QML application work to Qt 5:</p>
<ol class="1">
<li>Open the <i>flickr</i> project using Qt Creator.</li>
<li>Edit all the <tt>.qml</tt> files and replace the <tt>import QtQuick 1.0</tt> statements with <tt>import QtQuick 2.0</tt>.</li>
<li>Add the additional <tt>import QtQuick.XmlListModel 2.0</tt> statement to <tt>qml/common/RssModel.qml</tt>.<p><b>Note: </b>XmlListModel is part of a submodule under QtQuick and it must be imported explicitly in order to use it.</p></li>
<li>Make the following changes to <tt>qmlapplicationviewer/qmlapplicationviewer.h</tt>:<ul>
<li>Replace the <tt>#include &lt;QtDeclarative/QDeclarativeView&gt;</tt> with <tt>#include &lt;QQuickView&gt;</tt>.</li>
<li>Replace <tt>QDeclarativeView</tt> with <tt>QQuickView</tt> in the class declaration for <tt>QmlApplicationViewer</tt>.</li>
<li>Replace the parameter for <tt>QmlApplicationViewer</tt> constructor from <tt>QWidget</tt> to <tt>QWindow</tt>.</li>
</ul>
</li>
<li>Make the following changes to <tt>qmlapplicationviewer/qmlapplicationviewer.cpp</tt>:<ul>
<li>Replace all the <tt>QtCore</tt> and <tt>QtDeclarative</tt> include statements with these:<pre class="cpp"><span class="preprocessor">#include &lt;QCoreApplication&gt;</span>
<span class="preprocessor">#include &lt;QDir&gt;</span>
<span class="preprocessor">#include &lt;QFileInfo&gt;</span>
<span class="preprocessor">#include &lt;QQmlComponent&gt;</span>
<span class="preprocessor">#include &lt;QQmlEngine&gt;</span>
<span class="preprocessor">#include &lt;QQmlContext&gt;</span>
<span class="preprocessor">#include &lt;QDebug&gt;</span></pre>
</li>
<li>Replace all instances of <tt>QWidget</tt> with <tt>QWindow</tt>, and <tt>QDeclarativeView</tt> with <tt>QQuickView</tt>.</li>
<li>Remove the code between <tt>#if defined(Q_OS_SYMBIAN)</tt> and <tt>#endif</tt> macros as Symbian platform is not supported in Qt 5.</li>
<li>Remove the code between <tt>#if QT_VERSION &lt; 0x040702</tt> and <tt>#else</tt>, and <tt>#endif // QT_VERSION &lt; 0x040702</tt> macros towards the end.</li>
</ul>
</li>
<li>Save changes to the project and run the application.</li>
</ol>
<p>Once you see the application running, check whether it behaves as expected. Here is a snapshot of the application running on Ubuntu v12.04:</p>
<p class="centerAlign"><img src="images/flickr_application.png" alt="" /></p><a name="related-topics"></a>
<h2>Related Topics</h2>
<p><a href="qtquick-porting-qt5.html">Porting QML Applications to Qt 5</a></p>
</div>
<!-- @@@portingqmlapp.html -->
</div>
</div>
</div>
<div class="footer">
    <p>
      <acronym title="Copyright">&copy;</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>