/usr/share/qt5/doc/qtquick/qtquick-demos-photosurface-example.html is in qtdeclarative5-doc-html 5.5.1-2ubuntu6.
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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- photosurface.qdoc -->
<title>Qt Quick Demo - Photo Surface | Qt Quick 5.5</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.5</li>
<li><a href="qtquick-index.html">Qt Quick</a></li>
<li>Qt Quick Demo - Photo Surface</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
</ul>
</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="#running-the-example">Running the Example</a></li>
<li class="level1"><a href="#creating-the-main-window">Creating the Main Window</a></li>
<li class="level1"><a href="#accessing-folder-contents">Accessing Folder Contents</a></li>
<li class="level1"><a href="#displaying-images-on-the-photo-surface">Displaying Images on the Photo Surface</a></li>
<li class="level1"><a href="#handling-pinch-gestures">Handling Pinch Gestures</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Qt Quick Demo - Photo Surface</h1>
<span class="subtitle"></span>
<!-- $$$demos/photosurface-description -->
<div class="descr"> <a name="details"></a>
<p class="centerAlign"><img src="images/qtquick-demo-photosurface-small.png" alt="" /></p><p><i>Photo Surface</i> demonstrates how to use a <a href="qml-qtquick-repeater.html">Repeater</a> with a <a href="qml-qt-labs-folderlistmodel-folderlistmodel.html">FolderListModel</a> and a FileDialog to access images from a folder selected by a user and how to handle dragging, rotation and pinch zooming within the same item using a <a href="qml-qtquick-pincharea.html">PinchArea</a> that contains a <a href="qml-qtquick-mousearea.html">MouseArea</a>.</p>
<p>All the app code is contained in one QML file, photosurface.qml. Inline JavaScript code is used to place, rotate, and scale images on the photo surface.</p>
<a name="running-the-example"></a>
<h2 id="running-the-example">Running the Example</h2>
<p>To run the example from Qt Creator, open the <b>Welcome</b> mode and select the example from <b>Examples</b>. For more information, visit Building and Running an Example.</p>
<a name="creating-the-main-window"></a>
<h2 id="creating-the-main-window">Creating the Main Window</h2>
<p>To create the main window for the Photo Surface app, we use the <a href="qml-qtquick-window-window.html">Window</a> QML type as the root item. It automatically sets up the window for use with <a href="qtquick-index.html">Qt Quick</a> graphical types:</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-window-window.html">Window</a></span> {
<span class="name">id</span>: <span class="name">root</span>
<span class="name">visible</span>: <span class="number">true</span>
<span class="name">width</span>: <span class="number">1024</span>; <span class="name">height</span>: <span class="number">600</span>
<span class="name">color</span>: <span class="string">"black"</span>
property <span class="type">int</span> <span class="name">highestZ</span>: <span class="number">0</span>
property <span class="type">real</span> <span class="name">defaultSize</span>: <span class="number">200</span>
property <span class="type">var</span> <span class="name">currentFrame</span>: <span class="name">undefined</span></pre>
<p>To use the <a href="qml-qtquick-window-window.html">Window</a> type, we must import it:</p>
<pre class="cpp">import <span class="type"><a href="qtquick-module.html">QtQuick</a></span><span class="operator">.</span>Window <span class="number">2.1</span></pre>
<a name="accessing-folder-contents"></a>
<h2 id="accessing-folder-contents">Accessing Folder Contents</h2>
<p>We use a <a href="qml-qtquick-repeater.html">Repeater</a> QML type together with the <a href="qml-qt-labs-folderlistmodel-folderlistmodel.html">FolderListModel</a> to display GIF, JPG, and PNG images located in a folder:</p>
<pre class="qml"> <span class="type"><a href="qml-qtquick-repeater.html">Repeater</a></span> {
<span class="name">model</span>: <span class="name">FolderListModel</span> {
<span class="name">id</span>: <span class="name">folderModel</span>
<span class="name">objectName</span>: <span class="string">"folderModel"</span>
<span class="name">showDirs</span>: <span class="number">false</span>
<span class="name">nameFilters</span>: [<span class="string">"*.png"</span>, <span class="string">"*.jpg"</span>, <span class="string">"*.gif"</span>]
}</pre>
<p>To use the <a href="qml-qt-labs-folderlistmodel-folderlistmodel.html">FolderListModel</a> type, we must import it:</p>
<pre class="cpp">import <span class="type">Qt</span><span class="operator">.</span>labs<span class="operator">.</span>folderlistmodel <span class="number">1.0</span></pre>
<p>We use a FileDialog to enable users to select the folder that contains the images:</p>
<pre class="qml"> <span class="type">FileDialog</span> {
<span class="name">id</span>: <span class="name">fileDialog</span>
<span class="name">title</span>: <span class="string">"Choose a folder with some images"</span>
<span class="name">selectFolder</span>: <span class="number">true</span>
<span class="name">onAccepted</span>: <span class="name">folderModel</span>.<span class="name">folder</span> <span class="operator">=</span> <span class="name">fileUrl</span> <span class="operator">+</span> <span class="string">"/"</span>
}</pre>
<p>To use the FileDialog type, we must import Qt Quick Dialogs:</p>
<pre class="cpp">import <span class="type"><a href="qtquick-module.html">QtQuick</a></span><span class="operator">.</span>Dialogs <span class="number">1.0</span></pre>
<p>We use the <code>fileDialog.open()</code> function to open the file dialog when the app starts:</p>
<pre class="cpp">Component<span class="operator">.</span>onCompleted: fileDialog<span class="operator">.</span>open()</pre>
<p>Users can also click the file dialog icon to open the file dialog. We use an <a href="qtquick-imageelements-example.html#image">Image</a> QML type to display the icon. Inside the <a href="qtquick-imageelements-example.html#image">Image</a> type, we use a <a href="qml-qtquick-mousearea.html">MouseArea</a> with the <code>onClicked</code> signal handler to call the <code>fileDialog.open()</code> function:</p>
<pre class="qml"> <span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
<span class="name">anchors</span>.top: <span class="name">parent</span>.<span class="name">top</span>
<span class="name">anchors</span>.left: <span class="name">parent</span>.<span class="name">left</span>
<span class="name">anchors</span>.margins: <span class="number">10</span>
<span class="name">source</span>: <span class="string">"resources/folder.png"</span>
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">anchors</span>.margins: -<span class="number">10</span>
<span class="name">onClicked</span>: <span class="name">fileDialog</span>.<span class="name">open</span>()
}
}</pre>
<a name="displaying-images-on-the-photo-surface"></a>
<h2 id="displaying-images-on-the-photo-surface">Displaying Images on the Photo Surface</h2>
<p>We use a <a href="qml-qtquick-rectangle.html">Rectangle</a> as a delegate for a <a href="qml-qtquick-repeater.html">Repeater</a> to provide a frame for each image that the <a href="qml-qt-labs-folderlistmodel-folderlistmodel.html">FolderListModel</a> finds in the selected folder. We use JavaScript <code>Math()</code> methods to place the frames randomly on the photo surface and to rotate them at random angles, as well as to scale the images:</p>
<pre class="qml"> <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">photoFrame</span>
<span class="name">width</span>: <span class="name">image</span>.<span class="name">width</span> <span class="operator">*</span> (<span class="number">1</span> <span class="operator">+</span> <span class="number">0.10</span> <span class="operator">*</span> <span class="name">image</span>.<span class="name">height</span> <span class="operator">/</span> <span class="name">image</span>.<span class="name">width</span>)
<span class="name">height</span>: <span class="name">image</span>.<span class="name">height</span> <span class="operator">*</span> <span class="number">1.10</span>
<span class="name">scale</span>: <span class="name">defaultSize</span> <span class="operator">/</span> <span class="name">Math</span>.<span class="name">max</span>(<span class="name">image</span>.<span class="name">sourceSize</span>.<span class="name">width</span>, <span class="name">image</span>.<span class="name">sourceSize</span>.<span class="name">height</span>)
Behavior on <span class="name">scale</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">duration</span>: <span class="number">200</span> } }</pre>
<a name="handling-pinch-gestures"></a>
<h2 id="handling-pinch-gestures">Handling Pinch Gestures</h2>
<p>We use a <a href="qml-qtquick-pincharea.html">PinchArea</a> that contains a <a href="qml-qtquick-mousearea.html">MouseArea</a> in the photo frames to handle dragging, rotation and pinch zooming of the frame:</p>
<pre class="qml"> Behavior on <span class="name">x</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">duration</span>: <span class="number">200</span> } }
Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">duration</span>: <span class="number">200</span> } }
<span class="name">border</span>.color: <span class="string">"black"</span>
<span class="name">border</span>.width: <span class="number">2</span>
<span class="name">smooth</span>: <span class="number">true</span>
<span class="name">antialiasing</span>: <span class="number">true</span>
<span class="name">Component</span>.onCompleted: {
<span class="name">x</span> <span class="operator">=</span> <span class="name">Math</span>.<span class="name">random</span>() <span class="operator">*</span> <span class="name">root</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
<span class="name">y</span> <span class="operator">=</span> <span class="name">Math</span>.<span class="name">random</span>() <span class="operator">*</span> <span class="name">root</span>.<span class="name">height</span> <span class="operator">-</span> <span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
<span class="name">rotation</span> <span class="operator">=</span> <span class="name">Math</span>.<span class="name">random</span>() <span class="operator">*</span> <span class="number">13</span> <span class="operator">-</span> <span class="number">6</span>
}
<span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
<span class="name">id</span>: <span class="name">image</span>
<span class="name">anchors</span>.centerIn: <span class="name">parent</span>
<span class="name">fillMode</span>: <span class="name">Image</span>.<span class="name">PreserveAspectFit</span>
<span class="name">source</span>: <span class="name">folderModel</span>.<span class="name">folder</span> <span class="operator">+</span> <span class="name">fileName</span>
<span class="name">antialiasing</span>: <span class="number">true</span>
}
<span class="type"><a href="qml-qtquick-pincharea.html">PinchArea</a></span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">pinch</span>.target: <span class="name">photoFrame</span>
<span class="name">pinch</span>.minimumRotation: -<span class="number">360</span>
<span class="name">pinch</span>.maximumRotation: <span class="number">360</span>
<span class="name">pinch</span>.minimumScale: <span class="number">0.1</span>
<span class="name">pinch</span>.maximumScale: <span class="number">10</span>
<span class="name">pinch</span>.dragAxis: <span class="name">Pinch</span>.<span class="name">XAndYAxis</span>
<span class="name">onPinchStarted</span>: <span class="name">setFrameColor</span>();</pre>
<p>We use the <code>pinch</code> group property to control how the photo frames react to pinch gestures. The <code>pinch.target</code> sets <code>photoFrame</code> as the item to manipulate. The rotation properties specify that the frames can be rotated at all angles and the scale properties specify that they can be scaled between <code>0.1</code> and <code>10</code>.</p>
<p>In the <a href="qml-qtquick-mousearea.html">MouseArea</a>'s <code>onPressed</code> signal handler, we raise the selected photo frame to the top by increasing the value of its <code>z</code> property. The root item stores the z value of the top-most frame. The border color of the photo frame is controlled in the <code>onEntered</code> signal handler to highlight the selected image:</p>
<pre class="qml"> property <span class="type">real</span> <span class="name">zRestore</span>: <span class="number">0</span>
<span class="name">onSmartZoom</span>: {
<span class="keyword">if</span> (<span class="name">pinch</span>.<span class="name">scale</span> <span class="operator">></span> <span class="number">0</span>) {
<span class="name">photoFrame</span>.<span class="name">rotation</span> <span class="operator">=</span> <span class="number">0</span>;
<span class="name">photoFrame</span>.<span class="name">scale</span> <span class="operator">=</span> <span class="name">Math</span>.<span class="name">min</span>(<span class="name">root</span>.<span class="name">width</span>, <span class="name">root</span>.<span class="name">height</span>) <span class="operator">/</span> <span class="name">Math</span>.<span class="name">max</span>(<span class="name">image</span>.<span class="name">sourceSize</span>.<span class="name">width</span>, <span class="name">image</span>.<span class="name">sourceSize</span>.<span class="name">height</span>) <span class="operator">*</span> <span class="number">0.85</span>
<span class="name">photoFrame</span>.<span class="name">x</span> <span class="operator">=</span> <span class="name">flick</span>.<span class="name">contentX</span> <span class="operator">+</span> (<span class="name">flick</span>.<span class="name">width</span> <span class="operator">-</span> <span class="name">photoFrame</span>.<span class="name">width</span>) <span class="operator">/</span> <span class="number">2</span>
<span class="name">photoFrame</span>.<span class="name">y</span> <span class="operator">=</span> <span class="name">flick</span>.<span class="name">contentY</span> <span class="operator">+</span> (<span class="name">flick</span>.<span class="name">height</span> <span class="operator">-</span> <span class="name">photoFrame</span>.<span class="name">height</span>) <span class="operator">/</span> <span class="number">2</span>
<span class="name">zRestore</span> <span class="operator">=</span> <span class="name">photoFrame</span>.<span class="name">z</span>
<span class="name">photoFrame</span>.<span class="name">z</span> <span class="operator">=</span> ++<span class="name">root</span>.<span class="name">highestZ</span>;
} <span class="keyword">else</span> {
<span class="name">photoFrame</span>.<span class="name">rotation</span> <span class="operator">=</span> <span class="name">pinch</span>.<span class="name">previousAngle</span>
<span class="name">photoFrame</span>.<span class="name">scale</span> <span class="operator">=</span> <span class="name">pinch</span>.<span class="name">previousScale</span>
<span class="name">photoFrame</span>.<span class="name">x</span> <span class="operator">=</span> <span class="name">pinch</span>.<span class="name">previousCenter</span>.<span class="name">x</span> <span class="operator">-</span> <span class="name">photoFrame</span>.<span class="name">width</span> <span class="operator">/</span> <span class="number">2</span>
<span class="name">photoFrame</span>.<span class="name">y</span> <span class="operator">=</span> <span class="name">pinch</span>.<span class="name">previousCenter</span>.<span class="name">y</span> <span class="operator">-</span> <span class="name">photoFrame</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span>
<span class="name">photoFrame</span>.<span class="name">z</span> <span class="operator">=</span> <span class="name">zRestore</span>
--<span class="name">root</span>.<span class="name">highestZ</span>
}
}
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">id</span>: <span class="name">dragArea</span>
<span class="name">hoverEnabled</span>: <span class="number">true</span>
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">drag</span>.target: <span class="name">photoFrame</span>
<span class="name">scrollGestureEnabled</span>: <span class="number">false</span> <span class="comment">// 2-finger-flick gesture should pass through to the Flickable</span>
<span class="name">onPressed</span>: {
<span class="name">photoFrame</span>.<span class="name">z</span> <span class="operator">=</span> ++<span class="name">root</span>.<span class="name">highestZ</span>;
<span class="name">parent</span>.<span class="name">setFrameColor</span>();
}
<span class="name">onEntered</span>: <span class="name">parent</span>.<span class="name">setFrameColor</span>();</pre>
<p>To enable you to test the example on the desktop, we use the <a href="qml-qtquick-mousearea.html">MouseArea</a>'s <code>onWheel</code> signal handler to simulate pinch gestures by using a mouse:</p>
<pre class="qml"> <span class="name">onWheel</span>: {
<span class="keyword">if</span> (<span class="name">wheel</span>.<span class="name">modifiers</span> <span class="operator">&</span> <span class="name">Qt</span>.<span class="name">ControlModifier</span>) {
<span class="name">photoFrame</span>.<span class="name">rotation</span> <span class="operator">+=</span> <span class="name">wheel</span>.<span class="name">angleDelta</span>.<span class="name">y</span> <span class="operator">/</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">5</span>;
<span class="keyword">if</span> (<span class="name">Math</span>.<span class="name">abs</span>(<span class="name">photoFrame</span>.<span class="name">rotation</span>) <span class="operator"><</span> <span class="number">4</span>)
<span class="name">photoFrame</span>.<span class="name">rotation</span> <span class="operator">=</span> <span class="number">0</span>;
} <span class="keyword">else</span> {
<span class="name">photoFrame</span>.<span class="name">rotation</span> <span class="operator">+=</span> <span class="name">wheel</span>.<span class="name">angleDelta</span>.<span class="name">x</span> <span class="operator">/</span> <span class="number">120</span>;
<span class="keyword">if</span> (<span class="name">Math</span>.<span class="name">abs</span>(<span class="name">photoFrame</span>.<span class="name">rotation</span>) <span class="operator"><</span> <span class="number">0.6</span>)
<span class="name">photoFrame</span>.<span class="name">rotation</span> <span class="operator">=</span> <span class="number">0</span>;
var <span class="name">scaleBefore</span> = <span class="name">photoFrame</span>.<span class="name">scale</span>;
<span class="name">photoFrame</span>.<span class="name">scale</span> <span class="operator">+=</span> <span class="name">photoFrame</span>.<span class="name">scale</span> <span class="operator">*</span> <span class="name">wheel</span>.<span class="name">angleDelta</span>.<span class="name">y</span> <span class="operator">/</span> <span class="number">120</span> <span class="operator">/</span> <span class="number">10</span>;
}
}
}
<span class="keyword">function</span> <span class="name">setFrameColor</span>() {
<span class="keyword">if</span> (<span class="name">currentFrame</span>)
<span class="name">currentFrame</span>.<span class="name">border</span>.<span class="name">color</span> <span class="operator">=</span> <span class="string">"black"</span>;
<span class="name">currentFrame</span> <span class="operator">=</span> <span class="name">photoFrame</span>;
<span class="name">currentFrame</span>.<span class="name">border</span>.<span class="name">color</span> <span class="operator">=</span> <span class="string">"red"</span>;
}
}
}
}
}
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">verticalScrollDecorator</span>
<span class="name">anchors</span>.right: <span class="name">parent</span>.<span class="name">right</span>
<span class="name">anchors</span>.margins: <span class="number">2</span>
<span class="name">color</span>: <span class="string">"cyan"</span>
<span class="name">border</span>.color: <span class="string">"black"</span>
<span class="name">border</span>.width: <span class="number">1</span>
<span class="name">width</span>: <span class="number">5</span>
<span class="name">radius</span>: <span class="number">2</span>
<span class="name">antialiasing</span>: <span class="number">true</span>
<span class="name">height</span>: <span class="name">flick</span>.<span class="name">height</span> <span class="operator">*</span> (<span class="name">flick</span>.<span class="name">height</span> <span class="operator">/</span> <span class="name">flick</span>.<span class="name">contentHeight</span>) <span class="operator">-</span> (<span class="name">width</span> <span class="operator">-</span> <span class="name">anchors</span>.<span class="name">margins</span>) <span class="operator">*</span> <span class="number">2</span>
<span class="name">y</span>: <span class="name">flick</span>.<span class="name">contentY</span> <span class="operator">*</span> (<span class="name">flick</span>.<span class="name">height</span> <span class="operator">/</span> <span class="name">flick</span>.<span class="name">contentHeight</span>)
NumberAnimation on <span class="name">opacity</span> { <span class="name">id</span>: <span class="name">vfade</span>; <span class="name">to</span>: <span class="number">0</span>; <span class="name">duration</span>: <span class="number">500</span> }
<span class="name">onYChanged</span>: { <span class="name">opacity</span> <span class="operator">=</span> <span class="number">1.0</span>; <span class="name">fadeTimer</span>.<span class="name">restart</span>() }
}
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">horizontalScrollDecorator</span>
<span class="name">anchors</span>.bottom: <span class="name">parent</span>.<span class="name">bottom</span>
<span class="name">anchors</span>.margins: <span class="number">2</span>
<span class="name">color</span>: <span class="string">"cyan"</span>
<span class="name">border</span>.color: <span class="string">"black"</span>
<span class="name">border</span>.width: <span class="number">1</span>
<span class="name">height</span>: <span class="number">5</span>
<span class="name">radius</span>: <span class="number">2</span>
<span class="name">antialiasing</span>: <span class="number">true</span>
<span class="name">width</span>: <span class="name">flick</span>.<span class="name">width</span> <span class="operator">*</span> (<span class="name">flick</span>.<span class="name">width</span> <span class="operator">/</span> <span class="name">flick</span>.<span class="name">contentWidth</span>) <span class="operator">-</span> (<span class="name">height</span> <span class="operator">-</span> <span class="name">anchors</span>.<span class="name">margins</span>) <span class="operator">*</span> <span class="number">2</span>
<span class="name">x</span>: <span class="name">flick</span>.<span class="name">contentX</span> <span class="operator">*</span> (<span class="name">flick</span>.<span class="name">width</span> <span class="operator">/</span> <span class="name">flick</span>.<span class="name">contentWidth</span>)
NumberAnimation on <span class="name">opacity</span> { <span class="name">id</span>: <span class="name">hfade</span>; <span class="name">to</span>: <span class="number">0</span>; <span class="name">duration</span>: <span class="number">500</span> }
<span class="name">onXChanged</span>: { <span class="name">opacity</span> <span class="operator">=</span> <span class="number">1.0</span>; <span class="name">fadeTimer</span>.<span class="name">restart</span>() }
}
<span class="type">Timer</span> { <span class="name">id</span>: <span class="name">fadeTimer</span>; <span class="name">interval</span>: <span class="number">1000</span>; <span class="name">onTriggered</span>: { <span class="name">hfade</span>.<span class="name">start</span>(); <span class="name">vfade</span>.<span class="name">start</span>() } }
<span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
<span class="name">anchors</span>.top: <span class="name">parent</span>.<span class="name">top</span>
<span class="name">anchors</span>.left: <span class="name">parent</span>.<span class="name">left</span>
<span class="name">anchors</span>.margins: <span class="number">10</span>
<span class="name">source</span>: <span class="string">"resources/folder.png"</span>
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">anchors</span>.margins: -<span class="number">10</span>
<span class="name">onClicked</span>: <span class="name">fileDialog</span>.<span class="name">open</span>()
}
}
<span class="type"><a href="qml-qtquick-text.html">Text</a></span> {
<span class="name">anchors</span>.bottom: <span class="name">parent</span>.<span class="name">bottom</span>
<span class="name">anchors</span>.left: <span class="name">parent</span>.<span class="name">left</span>
<span class="name">anchors</span>.right: <span class="name">parent</span>.<span class="name">right</span>
<span class="name">anchors</span>.margins: <span class="number">10</span>
<span class="name">color</span>: <span class="string">"darkgrey"</span>
<span class="name">wrapMode</span>: <span class="name">Text</span>.<span class="name">WordWrap</span>
<span class="name">font</span>.pointSize: <span class="number">8</span>
<span class="name">text</span>: <span class="string">"On a touchscreen: use two fingers to zoom and rotate, one finger to drag\n"</span> <span class="operator">+</span>
<span class="string">"With a mouse: drag normally, use the vertical wheel to zoom, horizontal wheel to rotate, or hold Ctrl while using the vertical wheel to rotate"</span>
}
<span class="name">Component</span>.onCompleted: <span class="name">fileDialog</span>.<span class="name">open</span>()
}</pre>
<p>The <code>onWheel</code> signal handler is called in response to mouse wheel gestures. Use the vertical wheel to zoom and Ctrl and the vertical wheel to rotate frames. If the mouse has a horizontal wheel, use it to rotate frames.</p>
<p>Files:</p>
<ul>
<li><a href="qtquick-demos-photosurface-photosurface-qml.html">demos/photosurface/photosurface.qml</a></li>
<li><a href="qtquick-demos-photosurface-main-cpp.html">demos/photosurface/main.cpp</a></li>
<li><a href="qtquick-demos-photosurface-photosurface-pro.html">demos/photosurface/photosurface.pro</a></li>
<li><a href="qtquick-demos-photosurface-photosurface-qmlproject.html">demos/photosurface/photosurface.qmlproject</a></li>
<li><a href="qtquick-demos-photosurface-photosurface-qrc.html">demos/photosurface/photosurface.qrc</a></li>
</ul>
</div>
<p><b>See also </b>QML Applications.</p>
<!-- @@@demos/photosurface -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2015 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>
|