Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > d5e62c01ae8d1e579463c6a871dd44bf > files > 473

qtbase5-doc-5.12.6-2.mga7.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" />
<!-- qitemselectionmodel.cpp -->
  <title>QItemSelection Class | Qt Core 5.12.6</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.12</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QItemSelection</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtcore-index.html">Qt 5.12.6 Reference Documentation</a></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="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</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">QItemSelection Class</h1>
<!-- $$$QItemSelection-brief -->
<p>The <a href="qitemselection.html">QItemSelection</a> class manages information about selected items in a model. <a href="#details">More...</a></p>
<!-- @@@QItemSelection -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QItemSelection&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qlist.html">QList</a></td></tr></table></div><ul>
<li><a href="qitemselection-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qitemselection.html#QItemSelection">QItemSelection</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qitemselection.html#QItemSelection-1">QItemSelection</a></b>(const QModelIndex &amp;<i>topLeft</i>, const QModelIndex &amp;<i>bottomRight</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qitemselection.html#contains">contains</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QModelIndexList </td><td class="memItemRight bottomAlign"><b><a href="qitemselection.html#indexes">indexes</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qitemselection.html#merge">merge</a></b>(const QItemSelection &amp;<i>other</i>, QItemSelectionModel::SelectionFlags <i>command</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qitemselection.html#select">select</a></b>(const QModelIndex &amp;<i>topLeft</i>, const QModelIndex &amp;<i>bottomRight</i>)</td></tr>
</table></div>
<ul>
<li class="fn">78 public functions inherited from <a href="qlist.html#public-functions">QList</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qitemselection.html#split">split</a></b>(const QItemSelectionRange &amp;<i>range</i>, const QItemSelectionRange &amp;<i>other</i>, QItemSelection *<i>result</i>)</td></tr>
</table></div>
<ul>
<li class="fn">3 static public members inherited from <a href="qlist.html#static-public-members">QList</a></li>
</ul>
<a name="details"></a>
<!-- $$$QItemSelection-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qitemselection.html">QItemSelection</a> class manages information about selected items in a model.</p>
<p>A <a href="qitemselection.html">QItemSelection</a> describes the items in a model that have been selected by the user. A <a href="qitemselection.html">QItemSelection</a> is basically a list of selection ranges, see <a href="qitemselectionrange.html">QItemSelectionRange</a>. It provides functions for creating and manipulating selections, and selecting a range of items from a model.</p>
<p>The <a href="qitemselection.html">QItemSelection</a> class is one of the <a href="../qtwidgets/model-view-programming.html#model-view-classes">Model/View Classes</a> and is part of Qt's <a href="../qtwidgets/model-view-programming.html">model/view framework</a>.</p>
<p>An item selection can be constructed and initialized to contain a range of items from an existing model. The following example constructs a selection that contains a range of items from the given <code>model</code>, beginning at the <code>topLeft</code>, and ending at the <code>bottomRight</code>.</p>
<pre class="cpp">

  <span class="type"><a href="qitemselection.html#QItemSelection">QItemSelection</a></span> <span class="operator">*</span>selection <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qitemselection.html#QItemSelection">QItemSelection</a></span>(topLeft<span class="operator">,</span> bottomRight);

</pre>
<p>An empty item selection can be constructed, and later populated as required. So, if the model is going to be unavailable when we construct the item selection, we can rewrite the above code in the following way:</p>
<pre class="cpp">

  <span class="type"><a href="qitemselection.html#QItemSelection">QItemSelection</a></span> <span class="operator">*</span>selection <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qitemselection.html#QItemSelection">QItemSelection</a></span>();
  <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
  selection<span class="operator">-</span><span class="operator">&gt;</span>select(topLeft<span class="operator">,</span> bottomRight);

</pre>
<p><a href="qitemselection.html">QItemSelection</a> saves memory, and avoids unnecessary work, by working with selection ranges rather than recording the model item index for each item in the selection. Generally, an instance of this class will contain a list of non-overlapping selection ranges.</p>
<p>Use <a href="qitemselection.html#merge">merge</a>() to merge one item selection into another without making overlapping ranges. Use <a href="qitemselection.html#split">split</a>() to split one selection range into smaller ranges based on a another selection range.</p>
</div>
<p><b>See also </b><a href="../qtwidgets/model-view-programming.html">Model/View Programming</a> and <a href="qitemselectionmodel.html">QItemSelectionModel</a>.</p>
<!-- @@@QItemSelection -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QItemSelection[overload1]$$$QItemSelection -->
<h3 class="fn" id="QItemSelection"><a name="QItemSelection"></a>QItemSelection::<span class="name">QItemSelection</span>()</h3>
<p>Constructs an empty selection.</p>
<!-- @@@QItemSelection -->
<!-- $$$QItemSelection$$$QItemSelectionconstQModelIndex&constQModelIndex& -->
<h3 class="fn" id="QItemSelection-1"><a name="QItemSelection-1"></a>QItemSelection::<span class="name">QItemSelection</span>(const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> &amp;<i>topLeft</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> &amp;<i>bottomRight</i>)</h3>
<p>Constructs an item selection that extends from the top-left model item, specified by the <i>topLeft</i> index, to the bottom-right item, specified by <i>bottomRight</i>.</p>
<!-- @@@QItemSelection -->
<!-- $$$contains[overload1]$$$containsconstQModelIndex& -->
<h3 class="fn" id="contains"><a name="contains"></a><span class="type">bool</span> QItemSelection::<span class="name">contains</span>(const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns <code>true</code> if the selection contains the given <i>index</i>; otherwise returns <code>false</code>.</p>
<!-- @@@contains -->
<!-- $$$indexes[overload1]$$$indexes -->
<h3 class="fn" id="indexes"><a name="indexes"></a><span class="type"><a href="qmodelindex.html#QModelIndexList-typedef">QModelIndexList</a></span> QItemSelection::<span class="name">indexes</span>() const</h3>
<p>Returns a list of model indexes that correspond to the selected items.</p>
<!-- @@@indexes -->
<!-- $$$merge[overload1]$$$mergeconstQItemSelection&QItemSelectionModel::SelectionFlags -->
<h3 class="fn" id="merge"><a name="merge"></a><span class="type">void</span> QItemSelection::<span class="name">merge</span>(const <span class="type"><a href="qitemselection.html#QItemSelection">QItemSelection</a></span> &amp;<i>other</i>, <span class="type"><a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::SelectionFlags</a></span> <i>command</i>)</h3>
<p>Merges the <i>other</i> selection with this <a href="qitemselection.html">QItemSelection</a> using the <i>command</i> given. This method guarantees that no ranges are overlapping.</p>
<p>Note that only <a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::Select</a>, <a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::Deselect</a>, and <a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::Toggle</a> are supported.</p>
<p><b>See also </b><a href="qitemselection.html#split">split</a>().</p>
<!-- @@@merge -->
<!-- $$$select[overload1]$$$selectconstQModelIndex&constQModelIndex& -->
<h3 class="fn" id="select"><a name="select"></a><span class="type">void</span> QItemSelection::<span class="name">select</span>(const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> &amp;<i>topLeft</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> &amp;<i>bottomRight</i>)</h3>
<p>Adds the items in the range that extends from the top-left model item, specified by the <i>topLeft</i> index, to the bottom-right item, specified by <i>bottomRight</i> to the list.</p>
<p><b>Note: </b><i>topLeft</i> and <i>bottomRight</i> must have the same parent.</p><!-- @@@select -->
<!-- $$$split[overload1]$$$splitconstQItemSelectionRange&constQItemSelectionRange&QItemSelection* -->
<h3 class="fn" id="split"><a name="split"></a><code>[static] </code><span class="type">void</span> QItemSelection::<span class="name">split</span>(const <span class="type"><a href="qitemselectionrange.html">QItemSelectionRange</a></span> &amp;<i>range</i>, const <span class="type"><a href="qitemselectionrange.html">QItemSelectionRange</a></span> &amp;<i>other</i>, <span class="type"><a href="qitemselection.html#QItemSelection">QItemSelection</a></span> *<i>result</i>)</h3>
<p>Splits the selection <i>range</i> using the selection <i>other</i> range. Removes all items in <i>other</i> from <i>range</i> and puts the result in <i>result</i>. This can be compared with the semantics of the <i>subtract</i> operation of a set.</p>
<p><b>See also </b><a href="qitemselection.html#merge">merge</a>().</p>
<!-- @@@split -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 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>