/usr/share/qt5/doc/qtquickextras/qml-qtquick-extras-piemenu.html is in qtquickcontrols5-doc-html 5.5.1-1ubuntu1.
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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- PieMenu.qml -->
<title>PieMenu QML Type | Qt Quick Extras 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="qtquickextras-index.html">Qt Quick Extras</a></li>
<li><a href="qtquick-extras-qmlmodule.html">QML Types</a></li>
<li>PieMenu QML Type</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="#properties">Properties</a></li>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#populating-the-menu">Populating the Menu</a></li>
<li class="level2"><a href="#displaying-the-menu">Displaying the Menu</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">PieMenu QML Type</h1>
<span class="subtitle"></span>
<!-- $$$PieMenu-brief -->
<p>A popup menu that displays several menu items along an arc. <a href="#details">More...</a></p>
<!-- @@@PieMenu -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick.Extras 1.4</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.5</td></tr></table></div><ul>
<li><a href="qml-qtquick-extras-piemenu-members.html">List of all members, including inherited members</a></li>
<li><a href="qml-qtquick-extras-piemenu-obsolete.html">Obsolete members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-extras-piemenu.html#boundingItem-prop">boundingItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-extras-piemenu.html#currentIndex-prop">currentIndex</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-extras-piemenu.html#currentItem-prop">currentItem</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-extras-piemenu.html#menuItems-prop">menuItems</a></b></b> : list<MenuItem></li>
<li class="fn"><b><b><a href="qml-qtquick-extras-piemenu.html#selectionAngle-prop">selectionAngle</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-extras-piemenu.html#title-prop">title</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-extras-piemenu.html#triggerMode-prop">triggerMode</a></b></b> : int</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">void <b><b><a href="qml-qtquick-extras-piemenu.html#addItem-method">addItem</a></b></b>(string <i> text</i>)</li>
<li class="fn">void <b><b><a href="qml-qtquick-extras-piemenu.html#insertItem-method">insertItem</a></b></b>(int <i> before</i>, string <i> text</i>)</li>
<li class="fn">void <b><b><a href="qml-qtquick-extras-piemenu.html#popup-method">popup</a></b></b>(real <i> x</i>, real <i> y</i>)</li>
<li class="fn">void <b><b><a href="qml-qtquick-extras-piemenu.html#removeItem-method">removeItem</a></b></b>(<i> item</i>)</li>
</ul>
<!-- $$$PieMenu-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
</p>
<p class="centerAlign"><img src="images/piemenu.png" alt="A PieMenu" /></p><p>The <a href="qml-qtquick-extras-piemenu.html">PieMenu</a> provides a radial context menu as an alternative to a traditional menu. All of the items in a <a href="qml-qtquick-extras-piemenu.html">PieMenu</a> are an equal distance from the center of the control.</p>
<a name="populating-the-menu"></a>
<h3 >Populating the Menu</h3>
<p>To create a menu, define at least one MenuItem as a child of it:</p>
<pre class="cpp">PieMenu {
id: pieMenu
MenuItem {
text: <span class="string">"Action 1"</span>
onTriggered: print(<span class="string">"Action 1"</span>)
}
MenuItem {
text: <span class="string">"Action 2"</span>
onTriggered: print(<span class="string">"Action 2"</span>)
}
MenuItem {
text: <span class="string">"Action 3"</span>
onTriggered: print(<span class="string">"Action 3"</span>)
}
}</pre>
<p>By default, only the currently selected item's text is displayed above the menu. To provide text that is always visible when there is no current item, set the <a href="qml-qtquick-extras-piemenu.html#title-prop">title</a> property.</p>
<a name="displaying-the-menu"></a>
<h3 >Displaying the Menu</h3>
<p>The typical use case for a menu is to open at the point of the mouse cursor after a right click occurs. To do that, define a <a href="../qtquick/qml-qtquick-mousearea.html">MouseArea</a> that covers the region upon which clicks should open the menu. When the <a href="../qtquick/qml-qtquick-mousearea.html">MouseArea</a> is right-clicked, call the <a href="qml-qtquick-extras-piemenu.html#popup-method">popup()</a> function:</p>
<pre class="cpp">MouseArea {
anchors<span class="operator">.</span>fill: parent
acceptedButtons: <span class="type"><a href="../qtgui/qt.html">Qt</a></span><span class="operator">.</span>RightButton
onClicked: pieMenu<span class="operator">.</span>popup(mouseX<span class="operator">,</span> mouseY)
}</pre>
<p>If the menu is opened in a position where some of its menu items would be outside of <a href="qml-qtquick-extras-piemenu.html#boundingItem-prop">boundingItem</a>, it is automatically moved to a position where they will not be hidden. By default, the <a href="qml-qtquick-extras-piemenu.html#boundingItem-prop">boundingItem</a> is set to the parent of the menu. It can also be set to <code>null</code> to prevent this behavior.</p>
<p><a href="qml-qtquick-extras-piemenu.html">PieMenu</a> can be displayed at any position on the screen. With a traditional context menu, the menu would be positioned with its top left corner at the position of the right click, but since <a href="qml-qtquick-extras-piemenu.html">PieMenu</a> is radial, we position it centered over the position of the right click.</p>
<p>To create a <a href="qml-qtquick-extras-piemenu.html">PieMenu</a> that opens after a long press and selects items upon releasing, you can combine ActivationMode.ActivateOnRelease with a <a href="../qtquick/qml-qtquick-mousearea.html">MouseArea</a> using a Timer:</p>
<pre class="cpp">MouseArea {
id: touchArea
anchors<span class="operator">.</span>fill: parent
Timer {
id: pressAndHoldTimer
interval: <span class="number">300</span>
onTriggered: pieMenu<span class="operator">.</span>popup(touchArea<span class="operator">.</span>mouseX<span class="operator">,</span> touchArea<span class="operator">.</span>mouseY);
}
onPressed: pressAndHoldTimer<span class="operator">.</span>start()
onReleased: pressAndHoldTimer<span class="operator">.</span>stop();
}
PieMenu {
id: pieMenu
triggerMode: TriggerMode<span class="operator">.</span>TriggerOnRelease
MenuItem {
text: <span class="string">"Action 1"</span>
onTriggered: print(<span class="string">"Action 1"</span>)
}
MenuItem {
text: <span class="string">"Action 2"</span>
onTriggered: print(<span class="string">"Action 2"</span>)
}
MenuItem {
text: <span class="string">"Action 3"</span>
onTriggered: print(<span class="string">"Action 3"</span>)
}
}</pre>
<p>You can hide individual menu items by setting their visible property to <code>false</code>. Hiding items does not affect the startAngle or endAngle; the remaining items will grow to consume the available space.</p>
<p>You can create a custom appearance for a <a href="qml-qtquick-extras-piemenu.html">PieMenu</a> by assigning a PieMenuStyle</p>
<!-- @@@PieMenu -->
<h2>Property Documentation</h2>
<!-- $$$boundingItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="boundingItem-prop"><td class="tblQmlPropNode"><p><a name="boundingItem-prop"></a><span class="name">boundingItem</span> : <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span></p></td></tr></table></div></div><div class="qmldoc"><p>The item which the menu must stay within.</p>
<p>A typical use case for <a href="qml-qtquick-extras-piemenu.html">PieMenu</a> involves:</p>
<ul>
<li>A <a href="../qtquick/qml-qtquick-mousearea.html">MouseArea</a> that determines the clickable area within which the menu can be opened.</li>
<li>The bounds that the menu must not go outside of.</li>
</ul>
<p>Although they sound similar, they have different purposes. Consider the example below:</p>
<p class="centerAlign"><img src="images/piemenu-boundingItem-example.png" alt="Canvas boundingItem example" /></p><p>The user can only open the menu within the inner rectangle. In this case, they've opened the menu on the edge of the <a href="../qtquick/qml-qtquick-mousearea.html">MouseArea</a>, but there would not be enough room to display the entire menu centered at the cursor position, so it was moved to the left.</p>
<p>If for some reason we didn't want this restriction, we can set boundingItem to <code>null</code>:</p>
<p class="centerAlign"><img src="images/piemenu-boundingItem-null-example.png" alt="Canvas null boundingItem example" /></p><p>By default, the menu's <a href="../qtquick/qml-qtquick-item.html#parent-prop">parent</a> is the boundingItem.</p>
</div></div><!-- @@@boundingItem -->
<br/>
<!-- $$$currentIndex -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="currentIndex-prop"><td class="tblQmlPropNode"><p><a name="currentIndex-prop"></a><span class="qmlreadonly">read-only</span><span class="name">currentIndex</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>The index of the the menu item that is currently under the mouse, or <code>-1</code> if there is no such item.</p>
</div></div><!-- @@@currentIndex -->
<br/>
<!-- $$$currentItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="currentItem-prop"><td class="tblQmlPropNode"><p><a name="currentItem-prop"></a><span class="qmlreadonly">read-only</span><span class="name">currentItem</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>The menu item that is currently under the mouse, or <code>null</code> if there is no such item.</p>
</div></div><!-- @@@currentItem -->
<br/>
<!-- $$$menuItems -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="menuItems-prop"><td class="tblQmlPropNode"><p><a name="menuItems-prop"></a><span class="qmldefault">default</span><span class="name">menuItems</span> : <span class="type">list</span><<span class="type">MenuItem</span>></p></td></tr></table></div></div><div class="qmldoc"><p>The list of menu items displayed by this menu.</p>
<p>You can assign menu items by declaring them as children of <a href="qml-qtquick-extras-piemenu.html">PieMenu</a>:</p>
<pre class="cpp">PieMenu {
MenuItem {
text: <span class="string">"Action 1"</span>
onTriggered: function() { print(<span class="string">"Action 1"</span>); }
}
MenuItem {
text: <span class="string">"Action 2"</span>
onTriggered: function() { print(<span class="string">"Action 2"</span>); }
}
MenuItem {
text: <span class="string">"Action 3"</span>
onTriggered: function() { print(<span class="string">"Action 3"</span>); }
}
}</pre>
</div></div><!-- @@@menuItems -->
<br/>
<!-- $$$selectionAngle -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="selectionAngle-prop"><td class="tblQmlPropNode"><p><a name="selectionAngle-prop"></a><span class="qmlreadonly">read-only</span><span class="name">selectionAngle</span> : <span class="type">real</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property reflects the angle (in radians) created by the imaginary line from the center of the menu to the position of the cursor.</p>
<p>Its value is undefined when the menu is not visible.</p>
</div></div><!-- @@@selectionAngle -->
<br/>
<!-- $$$title -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="title-prop"><td class="tblQmlPropNode"><p><a name="title-prop"></a><span class="name">title</span> : <span class="type">string</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property defines the text that is shown above the menu when there is no current menu item (<a href="qml-qtquick-extras-piemenu.html#currentIndex-prop">currentIndex</a> is <code>-1</code>).</p>
<p>The default value is <code>""</code> (an empty string).</p>
</div></div><!-- @@@title -->
<br/>
<!-- $$$triggerMode -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="triggerMode-prop"><td class="tblQmlPropNode"><p><a name="triggerMode-prop"></a><span class="name">triggerMode</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property determines the method for selecting items in the menu.</p>
<ul>
<li>A triggerMode of <i>TriggerMode.TriggerOnPress</i> means that menu items will only be selected when a mouse press event occurs over them.</li>
<li>A triggerMode of <i>TriggerMode.TriggerOnRelease</i> means that menu items will only be selected when a mouse release event occurs over them. This means that the user must keep the mouse button down after opening the menu and release the mouse over the item they wish to select.</li>
<li>A triggerMode of <i>TriggerMode.TriggerOnClick</i> means that menu items will only be selected when the user clicks once over them.</li>
</ul>
<p><b>Warning:</b> Changing the triggerMode while the menu is visible will result in undefined behavior.</p>
</div></div><!-- @@@triggerMode -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$addItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="addItem-method"><td class="tblQmlFuncNode"><p><a name="addItem-method"></a><span class="type">void</span> <span class="name">addItem</span>(<span class="type">string</span><i> text</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Adds an item to the end of the menu items.</p>
<p>Equivalent to passing calling <code>insertItem(menuItems.length, text)</code>.</p>
<p>Returns the newly added item.</p>
</div></div><!-- @@@addItem -->
<br/>
<!-- $$$insertItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="insertItem-method"><td class="tblQmlFuncNode"><p><a name="insertItem-method"></a><span class="type">void</span> <span class="name">insertItem</span>(<span class="type">int</span><i> before</i>, <span class="type">string</span><i> text</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Inserts a MenuItem with <i>text</i> before the index at <i>before</i>.</p>
<p>To insert an item at the end, pass <code>menuItems.length</code>.</p>
<p>Returns the newly inserted item, or <code>null</code> if <i>before</i> is invalid.</p>
</div></div><!-- @@@insertItem -->
<br/>
<!-- $$$popup -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="popup-method"><td class="tblQmlFuncNode"><p><a name="popup-method"></a><span class="type">void</span> <span class="name">popup</span>(<span class="type">real</span><i> x</i>, <span class="type">real</span><i> y</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Opens the menu at coordinates <i>x</i>, <i>y</i>.</p>
</div></div><!-- @@@popup -->
<br/>
<!-- $$$removeItem -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="removeItem-method"><td class="tblQmlFuncNode"><p><a name="removeItem-method"></a><span class="type">void</span> <span class="name">removeItem</span>(<i> item</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Removes <i>item</i> from the menu.</p>
</div></div><!-- @@@removeItem -->
<br/>
</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>
|