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 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
|
<!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">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>QCPItemPosition Class Reference</title>
<link href="qt.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class=header>
<a class=headerLink href="index.html">Main Page</a> ·
<a class=headerLink href="classoverview.html">Class Overview</a> ·
<a class=headerLink href="hierarchy.html">Hierarchy</a> ·
<a class=headerLink href="annotated.html">All Classes</a>
</div>
<!-- Generated by Doxygen 1.8.1.2 -->
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-types">Public Types</a> |
<a href="#pub-methods">Public Functions</a> |
<a href="#pro-methods">Protected Functions</a> </div>
<div class="headertitle">
<div class="title">QCPItemPosition Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Manages the position of an item.
<a href="classQCPItemPosition.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for QCPItemPosition:</div>
<div class="dyncontent">
<div class="center"><img src="classQCPItemPosition__inherit__graph.png" border="0" usemap="#QCPItemPosition_inherit__map" alt="Inheritance graph"/></div>
<map name="QCPItemPosition_inherit__map" id="QCPItemPosition_inherit__map">
<area shape="rect" id="node2" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to." alt="" coords="8,6,117,31"/></map>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:aad9936c22bf43e3d358552f6e86dbdc8"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8">PositionType</a> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="pub-methods"></a>
Public Functions</h2></td></tr>
<tr class="memitem:a3efc524f37fdcd22907545eb77555ce4"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#a3efc524f37fdcd22907545eb77555ce4">QCPItemPosition</a> (<a class="el" href="classQCustomPlot.html">QCustomPlot</a> *parentPlot, <a class="el" href="classQCPAbstractItem.html">QCPAbstractItem</a> *parentItem, const QString name)</td></tr>
<tr class="memitem:ad64a1a26fbed5b8917e0eb8843099fd6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad64a1a26fbed5b8917e0eb8843099fd6"></a>
<a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8">PositionType</a> </td><td class="memItemRight" valign="bottom"><b>type</b> () const </td></tr>
<tr class="memitem:a0db87cc41efabc1cf94acee7ebe14eee"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0db87cc41efabc1cf94acee7ebe14eee"></a>
<a class="el" href="classQCPItemAnchor.html">QCPItemAnchor</a> * </td><td class="memItemRight" valign="bottom"><b>parentAnchor</b> () const </td></tr>
<tr class="memitem:ac3cb2bddf5f89e5181830be30b93d090"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac3cb2bddf5f89e5181830be30b93d090"></a>
double </td><td class="memItemRight" valign="bottom"><b>key</b> () const </td></tr>
<tr class="memitem:a6817f7356d3a2b63e8446c6b6106dae1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6817f7356d3a2b63e8446c6b6106dae1"></a>
double </td><td class="memItemRight" valign="bottom"><b>value</b> () const </td></tr>
<tr class="memitem:a253d7adbb6d46299bd6cbc31aa8819f1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a253d7adbb6d46299bd6cbc31aa8819f1"></a>
QPointF </td><td class="memItemRight" valign="bottom"><b>coords</b> () const </td></tr>
<tr class="memitem:ab99de7ae5766d246defb2de9f47eaf51"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab99de7ae5766d246defb2de9f47eaf51"></a>
<a class="el" href="classQCPAxis.html">QCPAxis</a> * </td><td class="memItemRight" valign="bottom"><b>keyAxis</b> () const </td></tr>
<tr class="memitem:a8d3a039fb2e69df86b4015daa30dfd2d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8d3a039fb2e69df86b4015daa30dfd2d"></a>
<a class="el" href="classQCPAxis.html">QCPAxis</a> * </td><td class="memItemRight" valign="bottom"><b>valueAxis</b> () const </td></tr>
<tr class="memitem:a7f10fa702a324880cc4de958f434cec7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7f10fa702a324880cc4de958f434cec7"></a>
<a class="el" href="classQCPAxisRect.html">QCPAxisRect</a> * </td><td class="memItemRight" valign="bottom"><b>axisRect</b> () const </td></tr>
<tr class="memitem:ae490f9c76ee2ba33752c495d3b6e8fb5"><td class="memItemLeft" align="right" valign="top">virtual QPointF </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#ae490f9c76ee2ba33752c495d3b6e8fb5">pixelPoint</a> () const </td></tr>
<tr class="memitem:aa476abf71ed8fa4c537457ebb1a754ad"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#aa476abf71ed8fa4c537457ebb1a754ad">setType</a> (<a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8">PositionType</a> type)</td></tr>
<tr class="memitem:ac094d67a95d2dceafa0d50b9db3a7e51"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#ac094d67a95d2dceafa0d50b9db3a7e51">setParentAnchor</a> (<a class="el" href="classQCPItemAnchor.html">QCPItemAnchor</a> *parentAnchor, bool keepPixelPosition=false)</td></tr>
<tr class="memitem:aa988ba4e87ab684c9021017dcaba945f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a> (double key, double value)</td></tr>
<tr class="memitem:acc70b3abc143287f806e5f154e5e07b0"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#acc70b3abc143287f806e5f154e5e07b0">setCoords</a> (const QPointF &coords)</td></tr>
<tr class="memitem:a2185f45c75ac8cb9be89daeaaad50e37"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#a2185f45c75ac8cb9be89daeaaad50e37">setAxes</a> (<a class="el" href="classQCPAxis.html">QCPAxis</a> *keyAxis, <a class="el" href="classQCPAxis.html">QCPAxis</a> *valueAxis)</td></tr>
<tr class="memitem:a0cd9b326fb324710169e92e8ca0041c2"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#a0cd9b326fb324710169e92e8ca0041c2">setAxisRect</a> (<a class="el" href="classQCPAxisRect.html">QCPAxisRect</a> *axisRect)</td></tr>
<tr class="memitem:ab404e56d9ac2ac2df0382c57933a71ef"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#ab404e56d9ac2ac2df0382c57933a71ef">setPixelPoint</a> (const QPointF &<a class="el" href="classQCPItemPosition.html#ae490f9c76ee2ba33752c495d3b6e8fb5">pixelPoint</a>)</td></tr>
<tr class="inherit_header pub_methods_classQCPItemAnchor"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classQCPItemAnchor')"><img src="closed.png" alt="-"/> Public Functions inherited from <a class="el" href="classQCPItemAnchor.html">QCPItemAnchor</a></td></tr>
<tr class="memitem:aeb6b681d2bf324db40a915d32ec5624f inherit pub_methods_classQCPItemAnchor"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemAnchor.html#aeb6b681d2bf324db40a915d32ec5624f">QCPItemAnchor</a> (<a class="el" href="classQCustomPlot.html">QCustomPlot</a> *parentPlot, <a class="el" href="classQCPAbstractItem.html">QCPAbstractItem</a> *parentItem, const QString name, int anchorId=-1)</td></tr>
<tr class="memitem:ac93984042a58c875e76847dc3e5f75fe inherit pub_methods_classQCPItemAnchor"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac93984042a58c875e76847dc3e5f75fe"></a>
QString </td><td class="memItemRight" valign="bottom"><b>name</b> () const </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="pro-methods"></a>
Protected Functions</h2></td></tr>
<tr class="memitem:a577a7efc601df85a20b3e709d1ac320e"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemPosition.html#a577a7efc601df85a20b3e709d1ac320e">toQCPItemPosition</a> ()</td></tr>
<tr class="inherit_header pro_methods_classQCPItemAnchor"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_classQCPItemAnchor')"><img src="closed.png" alt="-"/> Protected Functions inherited from <a class="el" href="classQCPItemAnchor.html">QCPItemAnchor</a></td></tr>
<tr class="memitem:ad11517e2ce5c2f9a798e78fb45e2e0d0 inherit pro_methods_classQCPItemAnchor"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemAnchor.html#ad11517e2ce5c2f9a798e78fb45e2e0d0">addChild</a> (<a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *pos)</td></tr>
<tr class="memitem:ab65ec61984575f737f43c2bb59dd0d76 inherit pro_methods_classQCPItemAnchor"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemAnchor.html#ab65ec61984575f737f43c2bb59dd0d76">removeChild</a> (<a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *pos)</td></tr>
</table>
<a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Manages the position of an item. </p>
<p>Every item has at least one public <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> member pointer which provides ways to position the item on the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> surface. Some items have multiple positions, for example <a class="el" href="classQCPItemRect.html" title="A rectangle.">QCPItemRect</a> has two: <em>topLeft</em> and <em>bottomRight</em>.</p>
<p><a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> has a type (<a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8">PositionType</a>) that can be set with <a class="el" href="classQCPItemPosition.html#aa476abf71ed8fa4c537457ebb1a754ad">setType</a>. This type defines how coordinates passed to <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a> are to be interpreted, e.g. as absolute pixel coordinates, as plot coordinates of certain axes, etc.</p>
<p>Further, <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> may have a parent <a class="el" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to.">QCPItemAnchor</a>, see <a class="el" href="classQCPItemPosition.html#ac094d67a95d2dceafa0d50b9db3a7e51">setParentAnchor</a>. (Note that every <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> inherits from <a class="el" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to.">QCPItemAnchor</a> and thus can itself be used as parent anchor for other positions.) This way you can tie multiple items together. If the <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> has a parent, the coordinates set with <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a> are considered to be absolute values in the reference frame of the parent anchor, where (0, 0) means directly ontop of the parent anchor. For example, You could attach the <em>start</em> position of a <a class="el" href="classQCPItemLine.html" title="A line from one point to another.">QCPItemLine</a> to the <em>bottom</em> anchor of a <a class="el" href="classQCPItemText.html" title="A text label.">QCPItemText</a> to make the starting point of the line always be centered under the text label, no matter where the text is moved to, or is itself tied to.</p>
<p>To set the apparent pixel position on the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> surface directly, use <a class="el" href="classQCPItemPosition.html#ab404e56d9ac2ac2df0382c57933a71ef">setPixelPoint</a>. This works no matter what type this <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> is or what parent-child situation it is in, as <a class="el" href="classQCPItemPosition.html#ab404e56d9ac2ac2df0382c57933a71ef">setPixelPoint</a> transforms the coordinates appropriately, to make the position appear at the specified pixel values. </p>
</div><h2>Member Enumeration Documentation</h2>
<a class="anchor" id="aad9936c22bf43e3d358552f6e86dbdc8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8">QCPItemPosition::PositionType</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Defines the ways an item position can be specified. Thus it defines what the numbers passed to <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a> actually mean.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classQCPItemPosition.html#aa476abf71ed8fa4c537457ebb1a754ad">setType</a> </dd></dl>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="aad9936c22bf43e3d358552f6e86dbdc8a564f5e53e550ead1ec5fc7fc7d0b73e0"></a>ptAbsolute</em> </td><td>
<p>Static positioning in pixels, starting from the top left corner of the viewport/widget. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="aad9936c22bf43e3d358552f6e86dbdc8ac7d6aa89ceacb39658b0d6da061c789a"></a>ptViewportRatio</em> </td><td>
<p>Static positioning given by a fraction of the viewport size. For example, if you call setCoords(0, 0), the position will be at the top left corner of the viewport/widget. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and vertically at the top of the viewport/widget, etc. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="aad9936c22bf43e3d358552f6e86dbdc8a01080fd00eaf09fa238ef6b73bbfef75"></a>ptAxisRectRatio</em> </td><td>
<p>Static positioning given by a fraction of the axis rect size (see <a class="el" href="classQCPItemPosition.html#a0cd9b326fb324710169e92e8ca0041c2">setAxisRect</a>). For example, if you call setCoords(0, 0), the position will be at the top left corner of the axis rect. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and vertically at the top of the axis rect, etc. You can also go beyond the axis rect by providing negative coordinates or coordinates larger than 1. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="aad9936c22bf43e3d358552f6e86dbdc8ad5ffb8dc99ad73263f7010c77342294c"></a>ptPlotCoords</em> </td><td>
<p>Dynamic positioning at a plot coordinate defined by two axes (see <a class="el" href="classQCPItemPosition.html#a2185f45c75ac8cb9be89daeaaad50e37">setAxes</a>). </p>
</td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="a3efc524f37fdcd22907545eb77555ce4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">QCPItemPosition::QCPItemPosition </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classQCustomPlot.html">QCustomPlot</a> * </td>
<td class="paramname"><em>parentPlot</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classQCPAbstractItem.html">QCPAbstractItem</a> * </td>
<td class="paramname"><em>parentItem</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const QString </td>
<td class="paramname"><em>name</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a>. You shouldn't create <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> instances directly, even if you want to make a new item subclass. Use <a class="el" href="classQCPAbstractItem.html#a75036d39c4d4e2e1a7dd145fff915d32">QCPAbstractItem::createPosition</a> instead, as explained in the subclassing section of the <a class="el" href="classQCPAbstractItem.html" title="The abstract base class for all items in a plot.">QCPAbstractItem</a> documentation. </p>
</div>
</div>
<h2>Member Function Documentation</h2>
<a class="anchor" id="ae490f9c76ee2ba33752c495d3b6e8fb5"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">QPointF QCPItemPosition::pixelPoint </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the final absolute pixel position of the <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> on the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> surface. It includes all effects of type (<a class="el" href="classQCPItemPosition.html#aa476abf71ed8fa4c537457ebb1a754ad">setType</a>) and possible parent anchors (<a class="el" href="classQCPItemPosition.html#ac094d67a95d2dceafa0d50b9db3a7e51">setParentAnchor</a>).</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classQCPItemPosition.html#ab404e56d9ac2ac2df0382c57933a71ef">setPixelPoint</a> </dd></dl>
<p>Reimplemented from <a class="el" href="classQCPItemAnchor.html#ae92def8f9297c5d73f5806c586517bb3">QCPItemAnchor</a>.</p>
</div>
</div>
<a class="anchor" id="aa476abf71ed8fa4c537457ebb1a754ad"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void QCPItemPosition::setType </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8">QCPItemPosition::PositionType</a> </td>
<td class="paramname"><em>type</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the type of the position. The type defines how the coordinates passed to <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a> should be handled and how the <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> should behave in the plot.</p>
<p>The possible values for <em>type</em> can be separated in two main categories:</p>
<ul>
<li>The position is regarded as a point in plot coordinates. This corresponds to <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8ad5ffb8dc99ad73263f7010c77342294c">ptPlotCoords</a> and requires two axes that define the plot coordinate system. They can be specified with <a class="el" href="classQCPItemPosition.html#a2185f45c75ac8cb9be89daeaaad50e37">setAxes</a>. By default, the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a>'s x- and yAxis are used.</li>
</ul>
<ul>
<li>The position is fixed on the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> surface, i.e. independent of axis ranges. This corresponds to all other types, i.e. <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8a564f5e53e550ead1ec5fc7fc7d0b73e0">ptAbsolute</a>, <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8ac7d6aa89ceacb39658b0d6da061c789a">ptViewportRatio</a> and <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8a01080fd00eaf09fa238ef6b73bbfef75">ptAxisRectRatio</a>. They differ only in the way the absolute position is described, see the documentation of <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8">PositionType</a> for details. For <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8a01080fd00eaf09fa238ef6b73bbfef75">ptAxisRectRatio</a>, note that you can specify the axis rect with <a class="el" href="classQCPItemPosition.html#a0cd9b326fb324710169e92e8ca0041c2">setAxisRect</a>. By default this is set to the main axis rect.</li>
</ul>
<p>Note that the position type <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8ad5ffb8dc99ad73263f7010c77342294c">ptPlotCoords</a> is only available (and sensible) when the position has no parent anchor (<a class="el" href="classQCPItemPosition.html#ac094d67a95d2dceafa0d50b9db3a7e51">setParentAnchor</a>).</p>
<p>If the type is changed, the apparent pixel position on the plot is preserved. This means the coordinates as retrieved with coords() and set with <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a> may change in the process. </p>
</div>
</div>
<a class="anchor" id="ac094d67a95d2dceafa0d50b9db3a7e51"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool QCPItemPosition::setParentAnchor </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classQCPItemAnchor.html">QCPItemAnchor</a> * </td>
<td class="paramname"><em>parentAnchor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"><em>keepPixelPosition</em> = <code>false</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the parent of this <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> to <em>parentAnchor</em>. This means the position will now follow any position changes of the anchor. The local coordinate system of positions with a parent anchor always is absolute with (0, 0) being exactly on top of the parent anchor. (Hence the type shouldn't be <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8ad5ffb8dc99ad73263f7010c77342294c">ptPlotCoords</a> for positions with parent anchors.)</p>
<p>if <em>keepPixelPosition</em> is true, the current pixel position of the <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> is preserved during reparenting. If it's set to false, the coordinates are set to (0, 0), i.e. the position will be exactly on top of the parent anchor.</p>
<p>To remove this <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> from any parent anchor, set <em>parentAnchor</em> to 0.</p>
<p>If the <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> previously had no parent and the type is <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8ad5ffb8dc99ad73263f7010c77342294c">ptPlotCoords</a>, the type is set to <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8a564f5e53e550ead1ec5fc7fc7d0b73e0">ptAbsolute</a>, to keep the position in a valid state. </p>
</div>
</div>
<a class="anchor" id="aa988ba4e87ab684c9021017dcaba945f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void QCPItemPosition::setCoords </td>
<td>(</td>
<td class="paramtype">double </td>
<td class="paramname"><em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>value</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the coordinates of this <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a>. What the coordinates mean, is defined by the type (<a class="el" href="classQCPItemPosition.html#aa476abf71ed8fa4c537457ebb1a754ad">setType</a>).</p>
<p>For example, if the type is <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8a564f5e53e550ead1ec5fc7fc7d0b73e0">ptAbsolute</a>, <em>key</em> and <em>value</em> mean the x and y pixel position on the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> surface. In that case the origin (0, 0) is in the top left corner of the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> viewport. If the type is <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8ad5ffb8dc99ad73263f7010c77342294c">ptPlotCoords</a>, <em>key</em> and <em>value</em> mean a point in the plot coordinate system defined by the axes set by <a class="el" href="classQCPItemPosition.html#a2185f45c75ac8cb9be89daeaaad50e37">setAxes</a>. By default those are the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a>'s xAxis and yAxis. See the documentation of <a class="el" href="classQCPItemPosition.html#aa476abf71ed8fa4c537457ebb1a754ad">setType</a> for other available coordinate types and their meaning.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classQCPItemPosition.html#ab404e56d9ac2ac2df0382c57933a71ef">setPixelPoint</a> </dd></dl>
</div>
</div>
<a class="anchor" id="acc70b3abc143287f806e5f154e5e07b0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void QCPItemPosition::setCoords </td>
<td>(</td>
<td class="paramtype">const QPointF & </td>
<td class="paramname"><em>pos</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This is an overloaded function.</p>
<p>Sets the coordinates as a QPointF <em>pos</em> where pos.x has the meaning of <em>key</em> and pos.y the meaning of <em>value</em> of the <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords(double key, double value)</a> method. </p>
</div>
</div>
<a class="anchor" id="a2185f45c75ac8cb9be89daeaaad50e37"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void QCPItemPosition::setAxes </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classQCPAxis.html">QCPAxis</a> * </td>
<td class="paramname"><em>keyAxis</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classQCPAxis.html">QCPAxis</a> * </td>
<td class="paramname"><em>valueAxis</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>When <a class="el" href="classQCPItemPosition.html#aa476abf71ed8fa4c537457ebb1a754ad">setType</a> is <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8ad5ffb8dc99ad73263f7010c77342294c">ptPlotCoords</a>, this function may be used to specify the axes the coordinates set with <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a> relate to. By default they are set to the initial xAxis and yAxis of the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a>. </p>
</div>
</div>
<a class="anchor" id="a0cd9b326fb324710169e92e8ca0041c2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void QCPItemPosition::setAxisRect </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classQCPAxisRect.html">QCPAxisRect</a> * </td>
<td class="paramname"><em>axisRect</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>When <a class="el" href="classQCPItemPosition.html#aa476abf71ed8fa4c537457ebb1a754ad">setType</a> is <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8a01080fd00eaf09fa238ef6b73bbfef75">ptAxisRectRatio</a>, this function may be used to specify the axis rect the coordinates set with <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a> relate to. By default this is set to the main axis rect of the <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a>. </p>
</div>
</div>
<a class="anchor" id="ab404e56d9ac2ac2df0382c57933a71ef"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void QCPItemPosition::setPixelPoint </td>
<td>(</td>
<td class="paramtype">const QPointF & </td>
<td class="paramname"><em>pixelPoint</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the apparent pixel position. This works no matter what type (<a class="el" href="classQCPItemPosition.html#aa476abf71ed8fa4c537457ebb1a754ad">setType</a>) this <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> is or what parent-child situation it is in, as coordinates are transformed appropriately, to make the position finally appear at the specified pixel values.</p>
<p>Only if the type is <a class="el" href="classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8a564f5e53e550ead1ec5fc7fc7d0b73e0">ptAbsolute</a> and no parent anchor is set, this function's effect is identical to that of <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a>.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classQCPItemPosition.html#ae490f9c76ee2ba33752c495d3b6e8fb5">pixelPoint</a>, <a class="el" href="classQCPItemPosition.html#aa988ba4e87ab684c9021017dcaba945f">setCoords</a> </dd></dl>
</div>
</div>
<a class="anchor" id="a577a7efc601df85a20b3e709d1ac320e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classQCPItemPosition.html">QCPItemPosition</a>* QCPItemPosition::toQCPItemPosition </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns 0 if this instance is merely a <a class="el" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to.">QCPItemAnchor</a>, and a valid pointer of type QCPItemPosition* if it actually is a <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item.">QCPItemPosition</a> (which is a subclass of <a class="el" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to.">QCPItemAnchor</a>).</p>
<p>This safe downcast functionality could also be achieved with a dynamic_cast. However, <a class="el" href="classQCustomPlot.html" title="The central class of the library. This is the QWidget which displays the plot and interacts with the ...">QCustomPlot</a> avoids dynamic_cast to work with projects that don't have RTTI support enabled (e.g. -fno-rtti flag with gcc compiler). </p>
<p>Reimplemented from <a class="el" href="classQCPItemAnchor.html#ac54b20120669950255a63587193dbb86">QCPItemAnchor</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/<a class="el" href="item_8h_source.html">item.h</a></li>
<li>src/item.cpp</li>
</ul>
</div><!-- contents -->
<div class="footer" />Generated with <a href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.1.2</div>
</body>
</html>
|