Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > 09bb53e5648f357bb3d35769c00e1902 > files > 65

qtwebengine5-doc-5.9.4-1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickwebenginehistory.cpp -->
  <title>WebEngineHistory QML Type | Qt WebEngine 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="qtwebengine-index.html">Qt WebEngine</a></td><td ><a href="qtwebengine-qmlmodule.html">QML Types</a></td><td >WebEngineHistory 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>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">WebEngineHistory QML Type</h1>
<span class="subtitle"></span>
<!-- $$$WebEngineHistory-brief -->
<p>Provides data models that represent the history of a web engine page. <a href="#details">More...</a></p>
<!-- @@@WebEngineHistory -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtWebEngine 1.5</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  QtWebEngine 1.1</td></tr></table></div><ul>
<li><a href="qml-qtwebengine-webenginehistory-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-qtwebengine-webenginehistory.html#backItems-prop">backItems</a></b></b> : WebEngineHistoryListModel</li>
<li class="fn"><b><b><a href="qml-qtwebengine-webenginehistory.html#forwardItems-prop">forwardItems</a></b></b> : WebEngineHistoryListModel</li>
<li class="fn"><b><b><a href="qml-qtwebengine-webenginehistory.html#items-prop">items</a></b></b> : WebEngineHistoryListModel</li>
</ul>
<!-- $$$WebEngineHistory-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>The <a href="qml-qtwebengine-webenginehistory.html">WebEngineHistory</a> type can be accessed by using the <a href="qml-qtwebengine-webengineview.html#navigationHistory-prop">WebEngineView.navigationHistory</a> property.</p>
<p>The <a href="qml-qtwebengine-webenginehistory.html">WebEngineHistory</a> type provides the following <a href="qml-qtwebengine-webenginehistorylistmodel.html">WebEngineHistoryListModel</a> data model objects:</p>
<ul>
<li><code>backItems</code>, which contains the URLs of visited pages.</li>
<li><code>forwardItems</code>, which contains the URLs of the pages that were visited after visiting the current page.</li>
<li><code>items</code>, which contains the URLs of the back and forward items, as well as the URL of the current page.</li>
</ul>
<p>The easiest way to use these models is to use them in a ListView as illustrated by the following code snippet:</p>
<pre class="cpp">

  ListView {
      id: historyItemsList
      anchors<span class="operator">.</span>fill: parent
      model: webEngineView<span class="operator">.</span>navigationHistory<span class="operator">.</span>items
      delegate:
          Text {
              color: <span class="string">&quot;black&quot;</span>
              text: model<span class="operator">.</span>title <span class="operator">+</span> <span class="string">&quot; - &quot;</span> <span class="operator">+</span> model<span class="operator">.</span>url <span class="operator">+</span> <span class="string">&quot; (&quot;</span> <span class="operator">+</span> model<span class="operator">.</span>offset <span class="operator">+</span> <span class="string">&quot;)&quot;</span>
          }
  }

</pre>
<p>The ListView shows the content of the corresponding model. The delegate is responsible for the format of the list items. The appearance of each item of the list in the delegate can be defined separately (it is not web engine specific).</p>
<p>The model roles <i>title</i>, <i>url</i>, and <i>icon</i> specify the title, URL, and favicon of the visited page. The <i>offset</i> role specifies the position of the page in respect to the current page (0). A positive number indicates that the page was visited after the current page, whereas a negative number indicates that the page was visited before the current page.</p>
<p>The data models can also be used to create a menu, as illustrated by the following code snippet:</p>
<pre class="qml">

      <span class="name">toolBar</span>: <span class="name">ToolBar</span> {
          <span class="name">id</span>: <span class="name">navigationBar</span>
              <span class="type">RowLayout</span> {
                  <span class="name">anchors</span>.fill: <span class="name">parent</span>
                  <span class="type">ToolButton</span> {
                      <span class="name">enabled</span>: <span class="name">currentWebView</span> <span class="operator">&amp;&amp;</span> (<span class="name">currentWebView</span>.<span class="name">canGoBack</span> <span class="operator">||</span> <span class="name">currentWebView</span>.<span class="name">canGoForward</span>)
                      <span class="name">menu</span>:<span class="name">Menu</span> {
                          <span class="name">id</span>: <span class="name">historyMenu</span>

                          <span class="type">Instantiator</span> {
                              <span class="name">model</span>: <span class="name">currentWebView</span> <span class="operator">&amp;&amp;</span> <span class="name">currentWebView</span>.<span class="name">navigationHistory</span>.<span class="name">items</span>
                              <span class="type">MenuItem</span> {
                                  <span class="name">text</span>: <span class="name">model</span>.<span class="name">title</span>
                                  <span class="name">onTriggered</span>: <span class="name">currentWebView</span>.<span class="name">goBackOrForward</span>(<span class="name">model</span>.<span class="name">offset</span>)
                                  <span class="name">checkable</span>: !<span class="name">enabled</span>
                                  <span class="name">checked</span>: !<span class="name">enabled</span>
                                  <span class="name">enabled</span>: <span class="name">model</span>.<span class="name">offset</span>
                              }

                              <span class="name">onObjectAdded</span>: <span class="name">historyMenu</span>.<span class="name">insertItem</span>(<span class="name">index</span>, <span class="name">object</span>)
                              <span class="name">onObjectRemoved</span>: <span class="name">historyMenu</span>.<span class="name">removeItem</span>(<span class="name">object</span>)
                          }
                      }
                  }

</pre>
<p>For the complete example, see <a href="qtwebengine-webengine-quicknanobrowser-example.html">WebEngine Quick Nano Browser</a>.</p>
<p><b>See also </b><a href="qml-qtwebengine-webenginehistorylistmodel.html">WebEngineHistoryListModel</a>.</p>
<!-- @@@WebEngineHistory -->
<h2>Property Documentation</h2>
<!-- $$$backItems -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="backItems-prop">
<td class="tblQmlPropNode"><p>
<a name="backItems-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">backItems</span> : <span class="type"><a href="qml-qtwebengine-webenginehistorylistmodel.html">WebEngineHistoryListModel</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>URLs of visited pages.</p>
</div></div><!-- @@@backItems -->
<br/>
<!-- $$$forwardItems -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="forwardItems-prop">
<td class="tblQmlPropNode"><p>
<a name="forwardItems-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">forwardItems</span> : <span class="type"><a href="qml-qtwebengine-webenginehistorylistmodel.html">WebEngineHistoryListModel</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>URLs of the pages that were visited after visiting the current page.</p>
</div></div><!-- @@@forwardItems -->
<br/>
<!-- $$$items -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="items-prop">
<td class="tblQmlPropNode"><p>
<a name="items-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">items</span> : <span class="type"><a href="qml-qtwebengine-webenginehistorylistmodel.html">WebEngineHistoryListModel</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>URLs of back items, forward items, and the current item in the history.</p>
</div></div><!-- @@@items -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</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>