/usr/share/qt5/doc/qtquick/qml-qtquick-state.html is in qtdeclarative5-doc-html 5.9.5-0ubuntu1.
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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickstate.cpp -->
<title>State QML Type | Qt Quick 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="qtquick-index.html">Qt Quick</a></td><td ><a href="qtquick-qmlmodule.html">QML Types</a></td><td >State 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="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">State QML Type</h1>
<span class="subtitle"></span>
<!-- $$$State-brief -->
<p>Defines configurations of objects and properties <a href="#details">More...</a></p>
<!-- @@@State -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.7</td></tr></table></div><ul>
<li><a href="qml-qtquick-state-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-state.html#changes-prop">changes</a></b></b> : list<Change></li>
<li class="fn"><b><b><a href="qml-qtquick-state.html#extend-prop">extend</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-state.html#name-prop">name</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-state.html#when-prop">when</a></b></b> : bool</li>
</ul>
<!-- $$$State-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>A <i>state</i> is a set of batched changes from the default configuration.</p>
<p>All items have a default state that defines the default configuration of objects and property values. New states can be defined by adding State items to the <a href="qml-qtquick-item.html#states-prop">states</a> property to allow items to switch between different configurations. These configurations can, for example, be used to apply different sets of property values or execute different scripts.</p>
<p>The following example displays a single <a href="qml-qtquick-rectangle.html">Rectangle</a>. In the default state, the rectangle is colored black. In the "clicked" state, a <a href="qml-qtquick-propertychanges.html">PropertyChanges</a> object changes the rectangle's color to red. Clicking within the <a href="qml-qtquick-mousearea.html">MouseArea</a> toggles the rectangle's state between the default state and the "clicked" state, thus toggling the color of the rectangle between black and red.</p>
<pre class="qml">
import QtQuick 2.0
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">myRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="string">"black"</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">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: <span class="name">myRect</span>.<span class="name">state</span> <span class="operator">==</span> <span class="string">'clicked'</span> ? <span class="name">myRect</span>.<span class="name">state</span> <span class="operator">=</span> <span class="string">""</span> : <span class="name">myRect</span>.<span class="name">state</span> <span class="operator">=</span> <span class="string">'clicked'</span>;
}
<span class="name">states</span>: [
<span class="type"><a href="qml-qtquick-state.html">State</a></span> {
<span class="name">name</span>: <span class="string">"clicked"</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">myRect</span>; <span class="name">color</span>: <span class="string">"red"</span> }
}
]
}
</pre>
<p>Notice the default state is referred to using an empty string ("").</p>
<p>States are commonly used together with <a href="qtquick-statesanimations-animations.html">Transitions</a> to provide animations when state changes occur.</p>
<p><b>Note: </b>Setting the state of an object from within another state of the same object is not allowed.</p><p><b>See also </b><a href="qtquick-animation-example.html#states">States example</a>, <a href="qtquick-statesanimations-states.html">Qt Quick States</a>, <a href="qtquick-statesanimations-animations.html">Transitions</a>, and Qt QML.</p>
<!-- @@@State -->
<h2>Property Documentation</h2>
<!-- $$$changes -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="changes-prop">
<td class="tblQmlPropNode"><p>
<a name="changes-prop"></a><span class="qmldefault">[default] </span><span class="name">changes</span> : <span class="type">list</span><<span class="type">Change</span>></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the changes to apply for this state</p>
<p>By default these changes are applied against the default state. If the state extends another state, then the changes are applied against the state being extended.</p>
</div></div><!-- @@@changes -->
<br/>
<!-- $$$extend -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="extend-prop">
<td class="tblQmlPropNode"><p>
<a name="extend-prop"></a><span class="name">extend</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the state that this state extends.</p>
<p>When a state extends another state, it inherits all the changes of that state.</p>
<p>The state being extended is treated as the base state in regards to the changes specified by the extending state.</p>
</div></div><!-- @@@extend -->
<br/>
<!-- $$$name -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="name-prop">
<td class="tblQmlPropNode"><p>
<a name="name-prop"></a><span class="name">name</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the name of the state.</p>
<p>Each state should have a unique name within its item.</p>
</div></div><!-- @@@name -->
<br/>
<!-- $$$when -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="when-prop">
<td class="tblQmlPropNode"><p>
<a name="when-prop"></a><span class="name">when</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds when the state should be applied.</p>
<p>This should be set to an expression that evaluates to <code>true</code> when you want the state to be applied. For example, the following <a href="qml-qtquick-rectangle.html">Rectangle</a> changes in and out of the "hidden" state when the <a href="qml-qtquick-mousearea.html">MouseArea</a> is pressed:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">myRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="string">"red"</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">anchors</span>.fill: <span class="name">parent</span> }
<span class="name">states</span>: <span class="name">State</span> {
<span class="name">name</span>: <span class="string">"hidden"</span>; <span class="name">when</span>: <span class="name">mouseArea</span>.<span class="name">pressed</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">myRect</span>; <span class="name">opacity</span>: <span class="number">0</span> }
}
}
</pre>
<p>If multiple states in a group have <code>when</code> clauses that evaluate to <code>true</code> at the same time, the first matching state will be applied. For example, in the following snippet <code>state1</code> will always be selected rather than <code>state2</code> when sharedCondition becomes <code>true</code>.</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-item.html">Item</a></span> {
<span class="name">states</span>: [
<span class="type"><a href="qml-qtquick-state.html">State</a></span> { <span class="name">name</span>: <span class="string">"state1"</span>; <span class="name">when</span>: <span class="name">sharedCondition</span> },
<span class="type"><a href="qml-qtquick-state.html">State</a></span> { <span class="name">name</span>: <span class="string">"state2"</span>; <span class="name">when</span>: <span class="name">sharedCondition</span> }
]
<span class="comment">// ...</span>
}
</pre>
</div></div><!-- @@@when -->
<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>
|