/usr/share/qt5/doc/qtquick/qtquick-draganddrop-example.html is in qtdeclarative5-doc-html 5.2.1-3ubuntu15.
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 | <?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" />
<!-- draganddrop.qdoc -->
<title>Qt Quick Examples - Drag and Drop | QtQuick 5.2</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li>Qt 5.2</li>
<li><a href="qtquick-index.html">Qt Quick</a></li>
<li>Qt Quick Examples - Drag and Drop</li>
<li id="buildversion">
Qt 5.2.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level2"><a href="#tiles-adds-drag-and-drop-to-simple-rectangles-which-you-can-drag-into-a-specific-grid">Tiles adds drag and drop to simple rectangles, which you can drag into a specific grid.</a></li>
<li class="level2"><a href="#gridview-adds-drag-and-drop-to-a-gridview-allowing-you-to-reorder-the-list">GridView adds drag and drop to a GridView, allowing you to reorder the list.</a></li>
</ul>
</div>
<h1 class="title">Qt Quick Examples - Drag and Drop</h1>
<span class="subtitle"></span>
<!-- $$$draganddrop-description -->
<div class="descr"> <a name="details"></a>
<p>This is a collection of QML drag and drop examples<p class="centerAlign"><img src="images/qml-draganddrop-example.png" alt="" /></p><p>This is a collection of small QML examples relating to drag and drop functionality.</p>
<a name="tiles-adds-drag-and-drop-to-simple-rectangles-which-you-can-drag-into-a-specific-grid"></a>
<h3>Tiles adds drag and drop to simple rectangles, which you can drag into a specific grid.</h3>
<p>It has a DragTile component which uses a <a href="qml-qtquick-mousearea.html">MouseArea</a> to move an item when dragged:</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
<span class="name">id</span>: <span class="name">root</span>
property <span class="type">string</span> <span class="name">colorKey</span>
<span class="name">width</span>: <span class="number">64</span>; <span class="name">height</span>: <span class="number">64</span>
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">id</span>: <span class="name">mouseArea</span>
<span class="name">width</span>: <span class="number">64</span>; <span class="name">height</span>: <span class="number">64</span>
<span class="name">anchors</span>.centerIn: <span class="name">parent</span>
<span class="name">drag</span>.target: <span class="name">tile</span>
<span class="name">onReleased</span>: <span class="name">parent</span> <span class="operator">=</span> <span class="name">tile</span>.<span class="name">Drag</span>.<span class="name">target</span> <span class="operator">!==</span> <span class="number">null</span> ? <span class="name">tile</span>.<span class="name">Drag</span>.<span class="name">target</span> : <span class="name">root</span>
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">tile</span>
<span class="name">width</span>: <span class="number">64</span>; <span class="name">height</span>: <span class="number">64</span>
<span class="name">anchors</span>.verticalCenter: <span class="name">parent</span>.<span class="name">verticalCenter</span>
<span class="name">anchors</span>.horizontalCenter: <span class="name">parent</span>.<span class="name">horizontalCenter</span>
<span class="name">color</span>: <span class="name">colorKey</span>
<span class="name">Drag</span>.keys: [ <span class="name">colorKey</span> ]
<span class="name">Drag</span>.active: <span class="name">mouseArea</span>.<span class="name">drag</span>.<span class="name">active</span>
<span class="name">Drag</span>.hotSpot.x: <span class="number">32</span>
<span class="name">Drag</span>.hotSpot.y: <span class="number">32</span>
<span class="name">states</span>: <span class="name">State</span> {
<span class="name">when</span>: <span class="name">mouseArea</span>.<span class="name">drag</span>.<span class="name">active</span>
<span class="type"><a href="qml-qtquick-parentchange.html">ParentChange</a></span> { <span class="name">target</span>: <span class="name">tile</span>; <span class="name">parent</span>: <span class="name">root</span> }
<span class="type"><a href="qml-qtquick-anchorchanges.html">AnchorChanges</a></span> { <span class="name">target</span>: <span class="name">tile</span>; <span class="name">anchors</span>.verticalCenter: <span class="name">undefined</span>; <span class="name">anchors</span>.horizontalCenter: <span class="name">undefined</span> }
}
}
}
}</pre>
<p>And a DropTile component which the dragged tiles can be dropped onto:</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-droparea.html">DropArea</a></span> {
<span class="name">id</span>: <span class="name">dragTarget</span>
property <span class="type">string</span> <span class="name">colorKey</span>
property <span class="type">alias</span> <span class="name">dropProxy</span>: <span class="name">dragTarget</span>
<span class="name">width</span>: <span class="number">64</span>; <span class="name">height</span>: <span class="number">64</span>
<span class="name">keys</span>: [ <span class="name">colorKey</span> ]
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">dropRectangle</span>
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">color</span>: <span class="name">colorKey</span>
<span class="name">states</span>: [
<span class="type"><a href="qml-qtquick-state.html">State</a></span> {
<span class="name">when</span>: <span class="name">dragTarget</span>.<span class="name">containsDrag</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> {
<span class="name">target</span>: <span class="name">dropRectangle</span>
<span class="name">color</span>: <span class="string">"grey"</span>
}
}
]
}
}</pre>
<p>The keys property of the <a href="qml-qtquick-droparea.html">DropArea</a> will only allow an item with matching key in it's Drag.keys property to be dropped on it.</p>
<a name="gridview-adds-drag-and-drop-to-a-gridview-allowing-you-to-reorder-the-list"></a>
<h3>GridView adds drag and drop to a GridView, allowing you to reorder the list.</h3>
<p>It uses a DelegateModel to move a delegate item to the position of another item it is dragged over.</p>
<pre class="qml"> <span class="name">model</span>: <span class="name">DelegateModel</span> {
<span class="name">delegate</span>: <span class="name">MouseArea</span> {
<span class="name">id</span>: <span class="name">delegateRoot</span>
property <span class="type">int</span> <span class="name">visualIndex</span>: <span class="name">DelegateModel</span>.<span class="name">itemsIndex</span>
<span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
<span class="name">drag</span>.target: <span class="name">icon</span>
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">icon</span>
<span class="name">width</span>: <span class="number">72</span>; <span class="name">height</span>: <span class="number">72</span>
<span class="type">anchors</span> {
<span class="name">horizontalCenter</span>: <span class="name">parent</span>.<span class="name">horizontalCenter</span>;
<span class="name">verticalCenter</span>: <span class="name">parent</span>.<span class="name">verticalCenter</span>
}
<span class="name">color</span>: <span class="name">model</span>.<span class="name">color</span>
<span class="name">radius</span>: <span class="number">3</span>
<span class="name">Drag</span>.active: <span class="name">delegateRoot</span>.<span class="name">drag</span>.<span class="name">active</span>
<span class="name">Drag</span>.source: <span class="name">delegateRoot</span>
<span class="name">Drag</span>.hotSpot.x: <span class="number">36</span>
<span class="name">Drag</span>.hotSpot.y: <span class="number">36</span>
<span class="name">states</span>: [
<span class="type"><a href="qml-qtquick-state.html">State</a></span> {
<span class="name">when</span>: <span class="name">icon</span>.<span class="name">Drag</span>.<span class="name">active</span>
<span class="type"><a href="qml-qtquick-parentchange.html">ParentChange</a></span> {
<span class="name">target</span>: <span class="name">icon</span>
<span class="name">parent</span>: <span class="name">root</span>
}
<span class="type"><a href="qml-qtquick-anchorchanges.html">AnchorChanges</a></span> {
<span class="name">target</span>: <span class="name">icon</span>;
<span class="name">anchors</span>.horizontalCenter: <span class="name">undefined</span>;
<span class="name">anchors</span>.verticalCenter: <span class="name">undefined</span>
}
}
]
}
<span class="type"><a href="qml-qtquick-droparea.html">DropArea</a></span> {
<span class="type">anchors</span> { <span class="name">fill</span>: <span class="name">parent</span>; <span class="name">margins</span>: <span class="number">15</span> }
<span class="name">onEntered</span>: <span class="name">visualModel</span>.<span class="name">items</span>.<span class="name">move</span>(<span class="name">drag</span>.<span class="name">source</span>.<span class="name">visualIndex</span>, <span class="name">delegateRoot</span>.<span class="name">visualIndex</span>)
}
}</pre>
<p>Files:</p>
<ul>
<li><a href="qtquick-draganddrop-draganddrop-qml.html">draganddrop/draganddrop.qml</a></li>
<li><a href="qtquick-draganddrop-tiles-dragtile-qml.html">draganddrop/tiles/DragTile.qml</a></li>
<li><a href="qtquick-draganddrop-tiles-droptile-qml.html">draganddrop/tiles/DropTile.qml</a></li>
<li><a href="qtquick-draganddrop-tiles-tiles-qml.html">draganddrop/tiles/tiles.qml</a></li>
<li><a href="qtquick-draganddrop-views-gridview-qml.html">draganddrop/views/gridview.qml</a></li>
<li><a href="qtquick-draganddrop-main-cpp.html">draganddrop/main.cpp</a></li>
<li><a href="qtquick-draganddrop-draganddrop-pro.html">draganddrop/draganddrop.pro</a></li>
<li><a href="qtquick-draganddrop-draganddrop-qmlproject.html">draganddrop/draganddrop.qmlproject</a></li>
<li><a href="qtquick-draganddrop-draganddrop-qrc.html">draganddrop/draganddrop.qrc</a></li>
</ul>
</div>
<!-- @@@draganddrop -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
subsidiaries. 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> 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. </p>
</div>
</body>
</html>
|