<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qdeclarativeplaceeditorialmodel.cpp --> <title>EditorialModel QML Type | Qt Location 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtlocation-index.html">Qt Location</a></td><td ><a href="qtlocation-qmlmodule.html">QML Types</a></td><td >EditorialModel QML Type</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#properties">Properties</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> <li class="level2"><a href="#example">Example</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">EditorialModel QML Type</h1> <span class="subtitle"></span> <!-- $$$EditorialModel-brief --> <p>The <a href="qml-qtlocation-editorialmodel.html">EditorialModel</a> type provides a model of place editorials. <a href="#details">More...</a></p> <!-- @@@EditorialModel --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtLocation 5.3</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt Location 5.5</td></tr></table></div><ul> <li><a href="qml-qtlocation-editorialmodel-members.html">List of all members, including inherited members</a></li> </ul> <a name="properties"></a> <h2 id="properties">Properties</h2> <ul> <li class="fn"><b><b><a href="qml-qtlocation-editorialmodel.html#batchSize-prop">batchSize</a></b></b> : int</li> <li class="fn"><b><b><a href="qml-qtlocation-editorialmodel.html#place-prop">place</a></b></b> : Place</li> <li class="fn"><b><b><a href="qml-qtlocation-editorialmodel.html#totalCount-prop">totalCount</a></b></b> : int</li> </ul> <!-- $$$EditorialModel-description --> <a name="details"></a> <h2 id="details">Detailed Description</h2> <p>The <a href="qml-qtlocation-editorialmodel.html">EditorialModel</a> is a read-only model used to fetch editorials related to a <a href="qml-qtlocation-place.html">Place</a>. Binding a <a href="qml-qtlocation-place.html">Place</a> via <a href="qml-qtlocation-editorialmodel.html#place-prop">EditorialModel::place</a> initiates an initial fetch of editorials. The model performs fetches incrementally and is intended to be used in conjunction with a View such as a ListView. When the View reaches the last of the editorials currently in the model, a fetch is performed to retrieve more if they are available. The View is automatically updated as the editorials are received. The number of editorials which are fetched at a time is specified by the <a href="qml-qtlocation-editorialmodel.html#batchSize-prop">batchSize</a> property. The total number of editorials available can be accessed via the <a href="qml-qtlocation-editorialmodel.html#totalCount-prop">totalCount</a> property.</p> <p>The model returns data for the following roles:</p> <div class="table"><table class="generic"> <thead><tr class="qt-style"><th >Role</th><th >Type</th><th >Description</th></tr></thead> <tr valign="top" class="odd"><td >text</td><td >string</td><td >The editorial's textual description of the place. It can be either rich (HTML based) text or plain text depending upon the provider.</td></tr> <tr valign="top" class="even"><td >title</td><td >string</td><td >The title of the editorial.</td></tr> <tr valign="top" class="odd"><td >language</td><td >string</td><td >The language that the editorial is written in.</td></tr> <tr valign="top" class="even"><td >supplier</td><td ><a href="qml-qtlocation-supplier.html">Supplier</a></td><td >The supplier of the editorial.</td></tr> <tr valign="top" class="odd"><td >user</td><td ><a href="qml-qtlocation-user.html">User</a></td><td >The user who contributed the editorial.</td></tr> <tr valign="top" class="even"><td >attribution</td><td >string</td><td >Attribution text which must be displayed when displaying the editorial.</td></tr> </table></div> <a name="example"></a> <h2 id="example">Example</h2> <p>The following example shows how to display editorials for a place:</p> <pre class="qml"> import QtQuick 2.0 import QtPositioning 5.5 import QtLocation 5.6 <span class="type"><a href="qml-qtlocation-editorialmodel.html">EditorialModel</a></span> { <span class="name">id</span>: <span class="name">editorialModel</span> <span class="name">batchSize</span>: <span class="number">3</span> <span class="name">place</span>: <span class="name">place</span> } <span class="type">ListView</span> { <span class="name">model</span>: <span class="name">editorialModel</span> <span class="name">delegate</span>: <span class="name">Item</span> { <span class="name">anchors</span>.fill: <span class="name">parent</span> <span class="type">Column</span> { <span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span> <span class="name">clip</span>: <span class="number">true</span> <span class="type">Text</span> { <span class="name">text</span>: <span class="name">title</span> <span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span> <span class="name">wrapMode</span>: <span class="name">Text</span>.<span class="name">WordWrap</span> <span class="name">font</span>.pixelSize: <span class="number">24</span> } <span class="type">Text</span> { <span class="name">text</span>: <span class="name">text</span> <span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span> <span class="name">wrapMode</span>: <span class="name">Text</span>.<span class="name">WordWrap</span> <span class="name">font</span>.pixelSize: <span class="number">20</span> } <span class="type">Row</span> { <span class="type">Image</span> { <span class="name">width</span>: <span class="number">16</span> <span class="name">height</span>: <span class="number">16</span> <span class="name">source</span>: <span class="name">supplier</span>.<span class="name">icon</span>.<span class="name">url</span>(<span class="name">Qt</span>.<span class="name">size</span>(<span class="name">width</span>, <span class="name">height</span>), <span class="name">Icon</span>.<span class="name">List</span>) } <span class="type">Text</span> { <span class="name">text</span>: <span class="string">"Provided by "</span> <span class="operator">+</span> <span class="name">supplier</span>.<span class="name">name</span> <span class="name">font</span>.pixelSize: <span class="number">16</span> } } <span class="type">Text</span> { <span class="name">text</span>: <span class="string">"Contributed by "</span> <span class="operator">+</span> <span class="name">user</span>.<span class="name">name</span> <span class="name">font</span>.pixelSize: <span class="number">16</span> } <span class="type">Text</span> { <span class="name">text</span>: <span class="name">attribution</span> <span class="name">font</span>.pixelSize: <span class="number">8</span> } } } } </pre> <!-- @@@EditorialModel --> <h2>Property Documentation</h2> <!-- $$$batchSize --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="batchSize-prop"> <td class="tblQmlPropNode"><p> <a name="batchSize-prop"></a><span class="name">batchSize</span> : <span class="type">int</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>This property holds the batch size to use when fetching more editorials items.</p> </div></div><!-- @@@batchSize --> <br/> <!-- $$$place --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="place-prop"> <td class="tblQmlPropNode"><p> <a name="place-prop"></a><span class="name">place</span> : <span class="type"><a href="qml-qtlocation-place.html">Place</a></span></p></td></tr> </table></div> </div><div class="qmldoc"><p>This property holds the Place that the editorials are for.</p> </div></div><!-- @@@place --> <br/> <!-- $$$totalCount --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="totalCount-prop"> <td class="tblQmlPropNode"><p> <a name="totalCount-prop"></a><span class="name">totalCount</span> : <span class="type">int</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>This property holds the total number of editorial items for the place.</p> </div></div><!-- @@@totalCount --> <br/> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> 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.<br> 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. </p> </div> </body> </html>