/usr/share/qt5/doc/qtquickcontrols2/qml-qtquick-controls2-swipedelegate.html is in qtquickcontrols2-5-doc-html 5.9.5-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickswipedelegate.cpp -->
<title>SwipeDelegate QML Type | Qt Quick Controls 2 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="qtquickcontrols2-index.html">Qt Quick Controls 2</a></td><td ><a href="qtquick-controls2-qmlmodule.html">QML Types</a></td><td >SwipeDelegate QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 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="#attached-properties">Attached Properties</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#attached-signals">Attached Signals</a></li>
<li class="level1"><a href="#methods">Methods</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">SwipeDelegate QML Type</h1>
<span class="subtitle"></span>
<!-- $$$SwipeDelegate-brief -->
<p>Swipable item delegate. <a href="#details">More...</a></p>
<!-- @@@SwipeDelegate -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick.Controls 2.2</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.7</td></tr></table></div><ul>
<li><a href="qml-qtquick-controls2-swipedelegate-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-qtquick-controls2-swipedelegate.html#swipe-prop">swipe</a></b></b><ul>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.position-prop">swipe.position</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.complete-prop">swipe.complete</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.enabled-prop">swipe.enabled</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.left-prop">swipe.left</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.behind-prop">swipe.behind</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.right-prop">swipe.right</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.leftItem-prop">swipe.leftItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.behindItem-prop">swipe.behindItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.rightItem-prop">swipe.rightItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.transition-prop">swipe.transition</a></b></b> : Transition</li>
</ul>
</li>
</ul>
<a name="attached-properties"></a>
<h2 id="attached-properties">Attached Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-controls2-swipedelegate.html#pressed-attached-prop">pressed</a></b></b> : bool</li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<ul>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.closed-signal">swipe.closed</a></b></b>()</li>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.completed-signal">swipe.completed</a></b></b>()</li>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.opened-signal">swipe.opened</a></b></b>()</li>
</ul>
<a name="attached-signals"></a>
<h2 id="attached-signals">Attached Signals</h2>
<ul>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-swipedelegate.html#clicked-signal">clicked</a></b></b>()</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.close-method">swipe.close</a></b></b>()</li>
<li class="fn">void <b><b><a href="qml-qtquick-controls2-swipedelegate.html#swipe.open-method">swipe.open</a></b></b>(enumeration <i>side</i>)</li>
</ul>
<!-- $$$SwipeDelegate-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p><a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> presents a view item that can be swiped left or right to expose more options or information. It is used as a delegate in views such as <a href="../qtquick/qml-qtquick-listview.html">ListView</a>.</p>
<p>In the following example, <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> is used in a <a href="../qtquick/qml-qtquick-listview.html">ListView</a> to allow items to be removed from it by swiping to the left:</p>
<pre class="qml">
<span class="type"><a href="../qtquick/qml-qtquick-listview.html">ListView</a></span> {
<span class="name">id</span>: <span class="name">listView</span>
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">model</span>: <span class="name">ListModel</span> {
<span class="type"><a href="../qtqml/qml-qtqml-models-listelement.html">ListElement</a></span> { <span class="name">sender</span>: <span class="string">"Bob Bobbleton"</span>; <span class="name">title</span>: <span class="string">"How are you going?"</span> }
<span class="type"><a href="../qtqml/qml-qtqml-models-listelement.html">ListElement</a></span> { <span class="name">sender</span>: <span class="string">"Rug Emporium"</span>; <span class="name">title</span>: <span class="string">"SALE! All rugs MUST go!"</span> }
<span class="type"><a href="../qtqml/qml-qtqml-models-listelement.html">ListElement</a></span> { <span class="name">sender</span>: <span class="string">"Electric Co."</span>; <span class="name">title</span>: <span class="string">"Electricity bill 15/07/2016 overdue"</span> }
<span class="type"><a href="../qtqml/qml-qtqml-models-listelement.html">ListElement</a></span> { <span class="name">sender</span>: <span class="string">"Tips"</span>; <span class="name">title</span>: <span class="string">"Five ways this tip will save your life"</span> }
}
<span class="name">delegate</span>: <span class="name">SwipeDelegate</span> {
<span class="name">id</span>: <span class="name">swipeDelegate</span>
<span class="name">text</span>: <span class="name">model</span>.<span class="name">sender</span> <span class="operator">+</span> <span class="string">" - "</span> <span class="operator">+</span> <span class="name">model</span>.<span class="name">title</span>
<span class="name">width</span>: <span class="name">parent</span>.<span class="name">width</span>
<span class="name">ListView</span>.onRemove: <span class="name">SequentialAnimation</span> {
<span class="type"><a href="../qtquick/qml-qtquick-propertyaction.html">PropertyAction</a></span> {
<span class="name">target</span>: <span class="name">swipeDelegate</span>
<span class="name">property</span>: <span class="string">"ListView.delayRemove"</span>
<span class="name">value</span>: <span class="number">true</span>
}
<span class="type"><a href="../qtquick/qml-qtquick-numberanimation.html">NumberAnimation</a></span> {
<span class="name">target</span>: <span class="name">swipeDelegate</span>
<span class="name">property</span>: <span class="string">"height"</span>
<span class="name">to</span>: <span class="number">0</span>
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InOutQuad</span>
}
<span class="type"><a href="../qtquick/qml-qtquick-propertyaction.html">PropertyAction</a></span> {
<span class="name">target</span>: <span class="name">swipeDelegate</span>
<span class="name">property</span>: <span class="string">"ListView.delayRemove"</span>
<span class="name">value</span>: <span class="number">false</span>
}
}
<span class="name">swipe</span>.right: <span class="name">Label</span> {
<span class="name">id</span>: <span class="name">deleteLabel</span>
<span class="name">text</span>: <span class="name">qsTr</span>(<span class="string">"Delete"</span>)
<span class="name">color</span>: <span class="string">"white"</span>
<span class="name">verticalAlignment</span>: <span class="name">Label</span>.<span class="name">AlignVCenter</span>
<span class="name">padding</span>: <span class="number">12</span>
<span class="name">height</span>: <span class="name">parent</span>.<span class="name">height</span>
<span class="name">anchors</span>.right: <span class="name">parent</span>.<span class="name">right</span>
<span class="name">SwipeDelegate</span>.onClicked: <span class="name">listView</span>.<span class="name">model</span>.<span class="name">remove</span>(<span class="name">index</span>)
<span class="name">background</span>: <span class="name">Rectangle</span> {
<span class="name">color</span>: <span class="name">deleteLabel</span>.<span class="name">SwipeDelegate</span>.<span class="name">pressed</span> ? <span class="name">Qt</span>.<span class="name">darker</span>(<span class="string">"tomato"</span>, <span class="number">1.1</span>) : <span class="string">"tomato"</span>
}
}
}
}
</pre>
<p><a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> inherits its API from <a href="qml-qtquick-controls2-itemdelegate.html">ItemDelegate</a>, which is inherited from <a href="qml-qtquick-controls2-abstractbutton.html">AbstractButton</a>. For instance, you can set <a href="qml-qtquick-controls2-abstractbutton.html#text-prop">text</a>, and react to <a href="qml-qtquick-controls2-abstractbutton.html#clicked-signal">clicks</a> using the <a href="qml-qtquick-controls2-abstractbutton.html">AbstractButton</a> API.</p>
<p>Information regarding the progress of a swipe, as well as the components that should be shown upon swiping, are both available through the <a href="qml-qtquick-controls2-swipedelegate.html#swipe-prop">swipe</a> grouped property object. For example, <code>swipe.position</code> holds the position of the swipe within the range <code>-1.0</code> to <code>1.0</code>. The <code>swipe.left</code> property determines which item will be displayed when the control is swiped to the right, and vice versa for <code>swipe.right</code>. The positioning of these components is left to applications to decide. For example, without specifying any position for <code>swipe.left</code> or <code>swipe.right</code>, the following will occur:</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-swipedelegate.gif" alt="" /></p><p>If <code>swipe.left</code> and <code>swipe.right</code> are anchored to the left and right of the <a href="qml-qtquick-controls2-control.html#background-prop">background</a> item (respectively), they'll behave like this:</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-swipedelegate-leading-trailing.gif" alt="" /></p><p>When using <code>swipe.left</code> and <code>swipe.right</code>, the control cannot be swiped past the left and right edges. To achieve this type of "wrapping" behavior, set <code>swipe.behind</code> instead. This will result in the same item being shown regardless of which direction the control is swiped. For example, in the image below, we set <code>swipe.behind</code> and then swipe the control repeatedly in both directions:</p>
<p class="centerAlign"><img src="images/qtquickcontrols2-swipedelegate-behind.gif" alt="" /></p><p><b>See also </b><a href="qtquickcontrols2-customize.html#customizing-swipedelegate">Customizing SwipeDelegate</a>, <a href="qtquickcontrols2-delegates.html">Delegate Controls</a>, and <a href="qtquickcontrols2-swipetoremove-example.html">Swipe to Remove Example</a>.</p>
<!-- @@@SwipeDelegate -->
<h2>Property Documentation</h2>
<!-- $$$swipe -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="even" id="swipe-prop"><th class="centerAlign"><p><a name="swipe-prop"></a><b>swipe group</b></p></th></tr><tr valign="top" class="odd" id="swipe.position-prop"><td class="tblQmlPropNode"><p><a name="swipe.position-prop"></a><span class="name">swipe.position</span> : <span class="type">real</span></p></td></tr><tr valign="top" class="odd" id="swipe.complete-prop"><td class="tblQmlPropNode"><p><a name="swipe.complete-prop"></a><span class="name">swipe.complete</span> : <span class="type">bool</span></p></td></tr><tr valign="top" class="odd" id="swipe.enabled-prop"><td class="tblQmlPropNode"><p><a name="swipe.enabled-prop"></a><span class="name">swipe.enabled</span> : <span class="type">bool</span></p></td></tr><tr valign="top" class="odd" id="swipe.left-prop"><td class="tblQmlPropNode"><p><a name="swipe.left-prop"></a><span class="name">swipe.left</span> : <span class="type"><a href="../qtqml/qml-qtqml-component.html">Component</a></span></p></td></tr><tr valign="top" class="odd" id="swipe.behind-prop"><td class="tblQmlPropNode"><p><a name="swipe.behind-prop"></a><span class="name">swipe.behind</span> : <span class="type"><a href="../qtqml/qml-qtqml-component.html">Component</a></span></p></td></tr><tr valign="top" class="odd" id="swipe.right-prop"><td class="tblQmlPropNode"><p><a name="swipe.right-prop"></a><span class="name">swipe.right</span> : <span class="type"><a href="../qtqml/qml-qtqml-component.html">Component</a></span></p></td></tr><tr valign="top" class="odd" id="swipe.leftItem-prop"><td class="tblQmlPropNode"><p><a name="swipe.leftItem-prop"></a><span class="name">swipe.leftItem</span> : <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span></p></td></tr><tr valign="top" class="odd" id="swipe.behindItem-prop"><td class="tblQmlPropNode"><p><a name="swipe.behindItem-prop"></a><span class="name">swipe.behindItem</span> : <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span></p></td></tr><tr valign="top" class="odd" id="swipe.rightItem-prop"><td class="tblQmlPropNode"><p><a name="swipe.rightItem-prop"></a><span class="name">swipe.rightItem</span> : <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span></p></td></tr><tr valign="top" class="odd" id="swipe.transition-prop"><td class="tblQmlPropNode"><p><a name="swipe.transition-prop"></a><span class="name">swipe.transition</span> : <span class="type"><a href="../qtquick/qml-qtquick-transition.html">Transition</a></span></p></td></tr></table></div></div><div class="qmldoc"><div class="table"><table class="generic">
<thead><tr class="qt-style"><th >Name</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td >position</td><td >This read-only property holds the position of the swipe relative to either side of the control. When this value reaches either <code>-1.0</code> (left side) or <code>1.0</code> (right side) and the mouse button is released, <code>complete</code> will be <code>true</code>.</td></tr>
<tr valign="top" class="even"><td >complete</td><td >This read-only property holds whether the control is fully exposed after having been swiped to the left or right.<p>When complete is <code>true</code>, any interactive items declared in <code>left</code>, <code>right</code>, or <code>behind</code> will receive mouse events.</p>
</td></tr>
<tr valign="top" class="odd"><td >enabled</td><td >This property determines whether or not the control can be swiped.<p>This property was added in <a href="../qtqml/qtquick-qmlmodule.html">QtQuick</a>.Controls 2.2.</p>
</td></tr>
<tr valign="top" class="even"><td >left</td><td >This property holds the left delegate.<p>The left delegate sits behind both <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a> and <a href="qml-qtquick-controls2-control.html#background-prop">background</a>. When the <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> is swiped to the right, this item will be gradually revealed.</p>
<p>Both interactive and non-interactive items can be used here. Normal event handling rules apply; if an interactive control like <a href="qml-qtquick-controls2-button.html">Button</a> is used, interaction signals of <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> such as <a href="qml-qtquick-controls2-abstractbutton.html#clicked-signal">clicked()</a> will not get emitted if the button is clicked.</p>
</td></tr>
<tr valign="top" class="odd"><td >behind</td><td >This property holds the delegate that is shown when the <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> is swiped to both the left and right.<p>As with the <code>left</code> and <code>right</code> delegates, it sits behind both <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a> and <a href="qml-qtquick-controls2-control.html#background-prop">background</a>. However, a <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> whose <code>behind</code> has been set can be continuously swiped from either side, and will always show the same item.</p>
<p>Both interactive and non-interactive items can be used here. Normal event handling rules apply; if an interactive control like <a href="qml-qtquick-controls2-button.html">Button</a> is used, interaction signals of <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> such as <a href="qml-qtquick-controls2-abstractbutton.html#clicked-signal">clicked()</a> will not get emitted if the button is clicked.</p>
</td></tr>
<tr valign="top" class="even"><td >right</td><td >This property holds the right delegate.<p>The right delegate sits behind both <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a> and <a href="qml-qtquick-controls2-control.html#background-prop">background</a>. When the <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> is swiped to the left, this item will be gradually revealed.</p>
<p>Both interactive and non-interactive items can be used here. Normal event handling rules apply; if an interactive control like <a href="qml-qtquick-controls2-button.html">Button</a> is used, interaction signals of <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> such as <a href="qml-qtquick-controls2-abstractbutton.html#clicked-signal">clicked()</a> will not get emitted if the button is clicked.</p>
</td></tr>
<tr valign="top" class="odd"><td >leftItem</td><td >This read-only property holds the item instantiated from the <code>left</code> component.<p>If <code>left</code> has not been set, or the position hasn't changed since creation of the <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a>, this property will be <code>null</code>.</p>
</td></tr>
<tr valign="top" class="even"><td >behindItem</td><td >This read-only property holds the item instantiated from the <code>behind</code> component.<p>If <code>behind</code> has not been set, or the position hasn't changed since creation of the <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a>, this property will be <code>null</code>.</p>
</td></tr>
<tr valign="top" class="odd"><td >rightItem</td><td >This read-only property holds the item instantiated from the <code>right</code> component.<p>If <code>right</code> has not been set, or the position hasn't changed since creation of the <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a>, this property will be <code>null</code>.</p>
</td></tr>
<tr valign="top" class="even"><td >transition</td><td >This property holds the transition that is applied when a swipe is released, or <a href="qml-qtquick-controls2-swipedelegate.html#swipe.open-method">swipe.open()</a> or <a href="qml-qtquick-controls2-swipedelegate.html#swipe.close-method">swipe.close()</a> is called.<pre class="qml">
<span class="type"><a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a></span> {
<span class="name">swipe</span>.transition: <span class="name">Transition</span> {
<span class="type"><a href="../qtquick/qml-qtquick-smoothedanimation.html">SmoothedAnimation</a></span> { <span class="name">velocity</span>: <span class="number">3</span>; <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InOutCubic</span> }
}
}
</pre>
<p>This property was added in Qt Quick Controls 2.2.</p>
</td></tr>
</table></div>
<p><b>See also </b><a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a>, <a href="qml-qtquick-controls2-control.html#background-prop">background</a>, <a href="qml-qtquick-controls2-swipedelegate.html#swipe.open-method">swipe.open()</a>, and <a href="qml-qtquick-controls2-swipedelegate.html#swipe.close-method">swipe.close()</a>.</p>
</div></div><!-- @@@swipe -->
<br/>
<h2>Attached Property Documentation</h2>
<!-- $$$pressed -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="pressed-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="pressed-attached-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">SwipeDelegate.pressed</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property can be attached to a non-interactive item declared in <code>swipe.left</code>, <code>swipe.right</code>, or <code>swipe.behind</code>, in order to detect if it is pressed. Items can only be pressed when <code>swipe.complete</code> is <code>true</code>.</p>
<p>For example:</p>
<pre class="cpp">
swipe<span class="operator">.</span>right: Label {
anchors<span class="operator">.</span>right: parent<span class="operator">.</span>right
height: parent<span class="operator">.</span>height
text: <span class="string">"Action"</span>
color: <span class="string">"white"</span>
padding: <span class="number">12</span>
background: Rectangle {
color: SwipeDelegate<span class="operator">.</span>pressed <span class="operator">?</span> <span class="type"><a href="../qtqml/qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>darker(<span class="string">"tomato"</span><span class="operator">,</span> <span class="number">1.1</span>) : <span class="string">"tomato"</span>
}
}
</pre>
<p>It is possible to have multiple items which individually receive mouse and touch events. For example, to have two actions in the <code>swipe.right</code> item, use the following code:</p>
<pre class="cpp">
swipe<span class="operator">.</span>right: Row {
anchors<span class="operator">.</span>right: parent<span class="operator">.</span>right
height: parent<span class="operator">.</span>height
Label {
id: moveLabel
text: qsTr(<span class="string">"Move"</span>)
color: <span class="string">"white"</span>
verticalAlignment: Label<span class="operator">.</span>AlignVCenter
padding: <span class="number">12</span>
height: parent<span class="operator">.</span>height
SwipeDelegate<span class="operator">.</span>onClicked: console<span class="operator">.</span>log(<span class="string">"Moving..."</span>)
background: Rectangle {
color: moveLabel<span class="operator">.</span>SwipeDelegate<span class="operator">.</span>pressed <span class="operator">?</span> <span class="type"><a href="../qtqml/qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>darker(<span class="string">"#ffbf47"</span><span class="operator">,</span> <span class="number">1.1</span>) : <span class="string">"#ffbf47"</span>
}
}
Label {
id: deleteLabel
text: qsTr(<span class="string">"Delete"</span>)
color: <span class="string">"white"</span>
verticalAlignment: Label<span class="operator">.</span>AlignVCenter
padding: <span class="number">12</span>
height: parent<span class="operator">.</span>height
SwipeDelegate<span class="operator">.</span>onClicked: console<span class="operator">.</span>log(<span class="string">"Deleting..."</span>)
background: Rectangle {
color: deleteLabel<span class="operator">.</span>SwipeDelegate<span class="operator">.</span>pressed <span class="operator">?</span> <span class="type"><a href="../qtqml/qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>darker(<span class="string">"tomato"</span><span class="operator">,</span> <span class="number">1.1</span>) : <span class="string">"tomato"</span>
}
}
}
</pre>
<p>Note how the <code>color</code> assignment in each <a href="qml-qtquick-controls2-control.html#background-prop">background</a> item qualifies the attached property with the <code>id</code> of the label. This is important; using the attached properties on an item causes that item to accept events. Suppose we had left out the <code>id</code> in the previous example:</p>
<pre class="cpp">
color: SwipeDelegate<span class="operator">.</span>pressed <span class="operator">?</span> <span class="type"><a href="../qtqml/qml-qtqml-qt.html">Qt</a></span><span class="operator">.</span>darker(<span class="string">"tomato"</span><span class="operator">,</span> <span class="number">1.1</span>) : <span class="string">"tomato"</span>
</pre>
<p>The <a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a> background item is a child of the label, so it naturally receives events before it. In practice, this means that the background color will change, but the <code>onClicked</code> handler in the label will never get called.</p>
<p>For interactive controls (such as <a href="qml-qtquick-controls2-button.html">Button</a>) declared in these items, use their respective <code>pressed</code> property instead.</p>
<p>For presses on the <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> itself, use its <a href="qml-qtquick-controls2-abstractbutton.html#pressed-prop">pressed</a> property.</p>
<p>This QML property was introduced in QtQuick.Controls 2.1 (Qt 5.8).</p>
<p><b>See also </b><a href="qml-qtquick-controls2-swipedelegate.html#clicked-signal">clicked()</a>.</p>
</div></div><!-- @@@pressed -->
<br/>
<h2>Signal Documentation</h2>
<!-- $$$swipe.closed -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="swipe.closed-signal">
<td class="tblQmlFuncNode"><p>
<a name="swipe.closed-signal"></a><span class="type">void</span> <span class="name">swipe.closed</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when the delegate has been swiped to closed and the transition has finished.</p>
<p>It is useful for performing some action upon cancellation of a swipe. For example, it can be used to cancel the removal of the delegate from the list that it is in.</p>
<p>This QML signal was introduced in QtQuick.Controls 2.2 (Qt 5.9).</p>
<p><b>See also </b><a href="qml-qtquick-controls2-swipedelegate.html#swipe-prop">swipe</a> and <a href="qml-qtquick-controls2-swipedelegate.html#swipe.opened-signal">swipe.opened()</a>.</p>
</div></div><!-- @@@swipe.closed -->
<br/>
<!-- $$$swipe.completed -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="swipe.completed-signal">
<td class="tblQmlFuncNode"><p>
<a name="swipe.completed-signal"></a><span class="type">void</span> <span class="name">swipe.completed</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when <code>swipe.complete</code> becomes <code>true</code>.</p>
<p>It is useful for performing some action upon completion of a swipe. For example, it can be used to remove the delegate from the list that it is in.</p>
<p>This QML signal was introduced in QtQuick.Controls 2.1 (Qt 5.8).</p>
<p><b>See also </b><a href="qml-qtquick-controls2-swipedelegate.html#swipe-prop">swipe</a>.</p>
</div></div><!-- @@@swipe.completed -->
<br/>
<!-- $$$swipe.opened -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="swipe.opened-signal">
<td class="tblQmlFuncNode"><p>
<a name="swipe.opened-signal"></a><span class="type">void</span> <span class="name">swipe.opened</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when the delegate has been swiped open and the transition has finished.</p>
<p>It is useful for performing some action upon completion of a swipe. For example, it can be used to remove the delegate from the list that it is in.</p>
<p>This QML signal was introduced in QtQuick.Controls 2.2 (Qt 5.9).</p>
<p><b>See also </b><a href="qml-qtquick-controls2-swipedelegate.html#swipe-prop">swipe</a> and <a href="qml-qtquick-controls2-swipedelegate.html#swipe.closed-signal">swipe.closed()</a>.</p>
</div></div><!-- @@@swipe.opened -->
<br/>
<h2>Attached Signal Documentation</h2>
<!-- $$$clicked -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="clicked-signal">
<td class="tblQmlFuncNode"><p>
<a name="clicked-signal"></a><span class="type">void</span> <span class="name">clicked</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal can be attached to a non-interactive item declared in <code>swipe.left</code>, <code>swipe.right</code>, or <code>swipe.behind</code>, in order to react to clicks. Items can only be clicked when <code>swipe.complete</code> is <code>true</code>.</p>
<p>For interactive controls (such as <a href="qml-qtquick-controls2-button.html">Button</a>) declared in these items, use their respective <code>clicked()</code> signal instead.</p>
<p>To respond to clicks on the <a href="qml-qtquick-controls2-swipedelegate.html">SwipeDelegate</a> itself, use its <a href="qml-qtquick-controls2-abstractbutton.html#clicked-signal">clicked()</a> signal.</p>
<p><b>Note: </b>See the documentation for <a href="qml-qtquick-controls2-swipedelegate.html#pressed-attached-prop">pressed</a> for information on how to use the event-related properties correctly.</p><p>This QML signal was introduced in QtQuick.Controls 2.1 (Qt 5.8).</p>
<p><b>See also </b><a href="qml-qtquick-controls2-swipedelegate.html#pressed-attached-prop">pressed</a>.</p>
</div></div><!-- @@@clicked -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$swipe.close -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="swipe.close-method">
<td class="tblQmlFuncNode"><p>
<a name="swipe.close-method"></a><span class="type">void</span> <span class="name">swipe.close</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This method sets the <code>position</code> of the swipe to <code>0</code>. Any animations defined for the <a href="../qtquick/qml-qtquick-item.html#x-prop">x</a> position of <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a> and <a href="qml-qtquick-controls2-control.html#background-prop">background</a> will be triggered.</p>
<p>This QML method was introduced in QtQuick.Controls 2.1 (Qt 5.8).</p>
<p><b>See also </b><a href="qml-qtquick-controls2-swipedelegate.html#swipe-prop">swipe</a> and <a href="qml-qtquick-controls2-swipedelegate.html#swipe.open-method">swipe.open()</a>.</p>
</div></div><!-- @@@swipe.close -->
<br/>
<!-- $$$swipe.open -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="swipe.open-method">
<td class="tblQmlFuncNode"><p>
<a name="swipe.open-method"></a><span class="type">void</span> <span class="name">swipe.open</span>(<span class="type">enumeration</span> <i>side</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This method sets the <code>position</code> of the swipe so that it opens from the specified <i>side</i>.</p>
<p>Available values:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>SwipeDelegate.Left</code></td><td class="topAlign">The <code>position</code> is set to <code>1</code>, which makes the swipe open from the left. Either <code>swipe.left</code> or <code>swipe.behind</code> must have been specified; otherwise the call is ignored.</td></tr>
<tr><td class="topAlign"><code>SwipeDelegate.Right</code></td><td class="topAlign">The <code>position</code> is set to <code>-1</code>, which makes the swipe open from the right. Either <code>swipe.right</code> or <code>swipe.behind</code> must have been specified; otherwise the call is ignored.</td></tr>
</table></div>
<p>Any animations defined for the <a href="../qtquick/qml-qtquick-item.html#x-prop">x</a> position of <a href="qml-qtquick-controls2-control.html#contentItem-prop">contentItem</a> and <a href="qml-qtquick-controls2-control.html#background-prop">background</a> will be triggered.</p>
<p>This QML method was introduced in QtQuick.Controls 2.2 (Qt 5.9).</p>
<p><b>See also </b><a href="qml-qtquick-controls2-swipedelegate.html#swipe-prop">swipe</a> and <a href="qml-qtquick-controls2-swipedelegate.html#swipe.close-method">swipe.close()</a>.</p>
</div></div><!-- @@@swipe.open -->
<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>
|