/usr/share/qt5/doc/qtquick/qtquick-input-mouseevents.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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- mouse.qdoc -->
<title>Mouse Events | 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>Mouse Events</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="#mouse-types">Mouse Types</a></li>
<li class="level1"><a href="#mouse-event-handling">Mouse Event Handling</a></li>
<li class="level1"><a href="#defining-a-mouse-area">Defining a Mouse Area</a></li>
<li class="level1"><a href="#receiving-events">Receiving Events</a></li>
<li class="level1"><a href="#enabling-gestures">Enabling Gestures</a></li>
<li class="level1"><a href="#mouseevent-object">MouseEvent Object</a></li>
<li class="level2"><a href="#accepting-further-signals">Accepting Further Signals</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Mouse Events</h1>
<span class="subtitle"></span>
<!-- $$$qtquick-input-mouseevents.html-description -->
<div class="descr"> <a name="details"></a>
<a name="mouse-types"></a>
<h2 id="mouse-types">Mouse Types</h2>
<ul>
<li><a href="qml-qtquick-mousearea.html">MouseArea</a> type</li>
<li><a href="qml-qtquick-mouseevent.html">MouseEvent</a> object</li>
</ul>
<a name="mouse-event-handling"></a>
<h2 id="mouse-event-handling">Mouse Event Handling</h2>
<p>QML uses signals and handlers to deliver mouse interactions. Specifically, Qt Quick provides the <a href="qml-qtquick-mousearea.html">MouseArea</a> and <a href="qml-qtquick-mouseevent.html">MouseEvent</a> types which allow developers to define signal handlers which accept mouse events within a defined area.</p>
<a name="defining-a-mouse-area"></a>
<h2 id="defining-a-mouse-area">Defining a Mouse Area</h2>
<p>The <a href="qml-qtquick-mousearea.html">MouseArea</a> type receives events within a defined area. One quick way to define this area is to anchor the <code>MouseArea</code> to its parent's area using the <code>anchors.fill</code> property. If the parent is a <a href="qml-qtquick-rectangle.html">Rectangle</a> (or any <a href="qml-qtquick-item.html">Item</a> component), then the <a href="qml-qtquick-mousearea.html">MouseArea</a> will fill the area defined by the parent's dimensions. Alternatively, an area smaller or larger than the parent is definable.</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">button</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</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">onClicked</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="string">"button clicked"</span>)
}
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">width</span>:<span class="number">150</span>; <span class="name">height</span>: <span class="number">75</span>
<span class="name">onClicked</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="string">"irregular area clicked"</span>)
}
}</pre>
<a name="receiving-events"></a>
<h2 id="receiving-events">Receiving Events</h2>
<p>The <a href="qml-qtquick-mousearea.html">MouseArea</a> type provides signals and handlers to detect different mouse events. The <a href="qml-qtquick-mousearea.html">MouseArea</a> type documentation describes these gestures in greater detail:</p>
<ul>
<li>canceled</li>
<li>clicked</li>
<li>doubleClicked</li>
<li>entered</li>
<li>exited</li>
<li>positionChanged</li>
<li>pressAndHold</li>
<li>pressed</li>
<li>released</li>
</ul>
<p>These signals have signal handlers that are invoked when the signals are emitted.</p>
<pre class="qml"> <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">onClicked</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="string">"area clicked"</span>)
<span class="name">onDoubleClicked</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="string">"area double clicked"</span>)
<span class="name">onEntered</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="string">"mouse entered the area"</span>)
<span class="name">onExited</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="string">"mouse left the area"</span>)
}</pre>
<a name="enabling-gestures"></a>
<h2 id="enabling-gestures">Enabling Gestures</h2>
<p>Some mouse gestures and button clicks need to be enabled before they send or receive events. Certain <a href="qml-qtquick-mousearea.html">MouseArea</a> and <a href="qml-qtquick-mouseevent.html">MouseEvent</a> properties enable these gestures.</p>
<p>To listen to (or explicitly ignore) a certain mouse button, set the appropriate mouse button to the <a href="qml-qtquick-mousearea.html#acceptedButtons-prop">acceptedButtons</a> property.</p>
<p>Naturally, the mouse events, such as button presses and mouse positions, are sent during a mouse click. For example, the <code>containsMouse</code> property will only retrieve its correct value during a mouse press. The <a href="qml-qtquick-mousearea.html#hoverEnabled-prop">hoverEnabled</a> will enable mouse events and positioning even when there are no mouse button presses. Setting the <code>hoverEnabled</code> property to <code>true</code>, in turn will enable the <code>entered</code>, <code>exited</code>, and <code>positionChanged</code> signal and their respective signal handlers.</p>
<pre class="qml"> <span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">hoverEnabled</span>: <span class="number">true</span>
<span class="name">acceptedButtons</span>: <span class="name">Qt</span>.<span class="name">LeftButton</span> <span class="operator">|</span> <span class="name">Qt</span>.<span class="name">RightButton</span>
<span class="name">onEntered</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="string">"mouse entered the area"</span>)
<span class="name">onExited</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="string">"mouse left the area"</span>)
}</pre>
<p>Additionally, to disable the whole mouse area, set the <a href="qml-qtquick-mousearea.html">MouseArea</a> <code>enabled</code> property to <code>false</code>.</p>
<a name="mouseevent-object"></a>
<h2 id="mouseevent-object">MouseEvent Object</h2>
<p>Signals and their handlers receive a <a href="qml-qtquick-mouseevent.html">MouseEvent</a> object as a parameter. The <code>mouse</code> object contain information about the mouse event. For example, the mouse button that started the event is queried through the <a href="qml-qtquick-mouseevent.html#button-prop">mouse.button</a> property.</p>
<p>The <code>MouseEvent</code> object can also ignore a mouse event using its <code>accepted</code> property.</p>
<a name="accepting-further-signals"></a>
<h3 >Accepting Further Signals</h3>
<p>Many of the signals are sent multiple times to reflect various mouse events such as double clicking. To facilitate the classification of mouse clicks, the <a href="qml-qtquick-mouseevent.html">MouseEvent</a> object has an <code>accepted</code> property to disable the event propagation.</p>
<p>To learn more about QML's event system, please read the signals and handlers, and event system document.</p>
</div>
<!-- @@@qtquick-input-mouseevents.html -->
</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>
|