classQCPItemAnchor.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta name="author" content="Emanuel Eichhammer" />
  6. <meta name="copyright" content="(C) 2013-2015 Emanuel Eichhammer" />
  7. <title>QCPItemAnchor Class Reference</title>
  8. <link href="qt.css" rel="stylesheet" type="text/css"/>
  9. </head>
  10. <body>
  11. <div id="top">
  12. <a class="headerLink" href="index.html">Main Page</a> &middot;
  13. <a class="headerLink" href="classoverview.html">Class Overview</a> &middot;
  14. <a class="headerLink" href="hierarchy.html">Hierarchy</a> &middot;
  15. <a class="headerLink" href="annotated.html">All Classes</a> &middot;
  16. <a class="headerLink" href="pages.html">Special Pages</a>
  17. <!-- Generated by Doxygen 1.8.6 -->
  18. </div><!-- top -->
  19. <div class="header">
  20. <div class="summary">
  21. <a href="#pub-methods">Public Functions</a> &#124;
  22. <a href="#pro-methods">Protected Functions</a> </div>
  23. <div class="headertitle">
  24. <div class="title">QCPItemAnchor Class Reference</div> </div>
  25. </div><!--header-->
  26. <div class="contents">
  27. <p>An anchor of an item to which positions can be attached to.
  28. <a href="classQCPItemAnchor.html#details">More...</a></p>
  29. <div class="dynheader">
  30. Inheritance diagram for QCPItemAnchor:</div>
  31. <div class="dyncontent">
  32. <div class="center"><img src="classQCPItemAnchor__inherit__graph.png" border="0" usemap="#QCPItemAnchor_inherit__map" alt="Inheritance graph"/></div>
  33. <map name="QCPItemAnchor_inherit__map" id="QCPItemAnchor_inherit__map">
  34. <area shape="rect" id="node2" href="classQCPItemPosition.html" title="Manages the position of an item. " alt="" coords="5,77,120,101"/></map>
  35. </div>
  36. <table class="memberdecls">
  37. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
  38. Public Functions</h2></td></tr>
  39. <tr class="memitem:aeb6b681d2bf324db40a915d32ec5624f"><td class="memItemLeft" align="right" valign="top">&#160;</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>
  40. <tr class="separator:aeb6b681d2bf324db40a915d32ec5624f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  41. <tr class="memitem:ac93984042a58c875e76847dc3e5f75fe"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac93984042a58c875e76847dc3e5f75fe"></a>
  42. QString&#160;</td><td class="memItemRight" valign="bottom"><b>name</b> () const </td></tr>
  43. <tr class="separator:ac93984042a58c875e76847dc3e5f75fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
  44. <tr class="memitem:ae92def8f9297c5d73f5806c586517bb3"><td class="memItemLeft" align="right" valign="top">virtual QPointF&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemAnchor.html#ae92def8f9297c5d73f5806c586517bb3">pixelPoint</a> () const </td></tr>
  45. <tr class="separator:ae92def8f9297c5d73f5806c586517bb3"><td class="memSeparator" colspan="2">&#160;</td></tr>
  46. </table><table class="memberdecls">
  47. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
  48. Protected Functions</h2></td></tr>
  49. <tr class="memitem:ac54b20120669950255a63587193dbb86"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemAnchor.html#ac54b20120669950255a63587193dbb86">toQCPItemPosition</a> ()</td></tr>
  50. <tr class="separator:ac54b20120669950255a63587193dbb86"><td class="memSeparator" colspan="2">&#160;</td></tr>
  51. <tr class="memitem:aef15daa640debfb11b0aeaa2116c6fbc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemAnchor.html#aef15daa640debfb11b0aeaa2116c6fbc">addChildX</a> (<a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *pos)</td></tr>
  52. <tr class="separator:aef15daa640debfb11b0aeaa2116c6fbc"><td class="memSeparator" colspan="2">&#160;</td></tr>
  53. <tr class="memitem:a230b1d494cda63458e289bbe1b642599"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemAnchor.html#a230b1d494cda63458e289bbe1b642599">removeChildX</a> (<a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *pos)</td></tr>
  54. <tr class="separator:a230b1d494cda63458e289bbe1b642599"><td class="memSeparator" colspan="2">&#160;</td></tr>
  55. <tr class="memitem:af05dc56f24536f0c7a9a0f57b58cea67"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemAnchor.html#af05dc56f24536f0c7a9a0f57b58cea67">addChildY</a> (<a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *pos)</td></tr>
  56. <tr class="separator:af05dc56f24536f0c7a9a0f57b58cea67"><td class="memSeparator" colspan="2">&#160;</td></tr>
  57. <tr class="memitem:aa2394911d8fff3bd958b9f4f1994b64d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPItemAnchor.html#aa2394911d8fff3bd958b9f4f1994b64d">removeChildY</a> (<a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *pos)</td></tr>
  58. <tr class="separator:aa2394911d8fff3bd958b9f4f1994b64d"><td class="memSeparator" colspan="2">&#160;</td></tr>
  59. </table>
  60. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  61. <div class="textblock"><p>An anchor of an item to which positions can be attached to. </p>
  62. <p>An item (<a class="el" href="classQCPAbstractItem.html" title="The abstract base class for all items in a plot. ">QCPAbstractItem</a>) may have one or more anchors. Unlike <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item. ">QCPItemPosition</a>, an anchor doesn't control anything on its item, but provides a way to tie other items via their positions to the anchor.</p>
  63. <p>For example, a <a class="el" href="classQCPItemRect.html" title="A rectangle. ">QCPItemRect</a> is defined by its positions <em>topLeft</em> and <em>bottomRight</em>. Additionally it has various anchors like <em>top</em>, <em>topRight</em> or <em>bottomLeft</em> etc. So you can attach the <em>start</em> (which is a <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item. ">QCPItemPosition</a>) of a <a class="el" href="classQCPItemLine.html" title="A line from one point to another. ">QCPItemLine</a> to one of the anchors by calling <a class="el" href="classQCPItemPosition.html#ac094d67a95d2dceafa0d50b9db3a7e51">QCPItemPosition::setParentAnchor</a> on <em>start</em>, passing the wanted anchor of the <a class="el" href="classQCPItemRect.html" title="A rectangle. ">QCPItemRect</a>. This way the start of the line will now always follow the respective anchor location on the rect item.</p>
  64. <p>Note that <a class="el" href="classQCPItemPosition.html" title="Manages the position of an item. ">QCPItemPosition</a> derives from <a class="el" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to. ">QCPItemAnchor</a>, so every position can also serve as an anchor to other positions.</p>
  65. <p>To learn how to provide anchors in your own item subclasses, see 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>
  66. </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
  67. <a class="anchor" id="aeb6b681d2bf324db40a915d32ec5624f"></a>
  68. <div class="memitem">
  69. <div class="memproto">
  70. <table class="memname">
  71. <tr>
  72. <td class="memname">QCPItemAnchor::QCPItemAnchor </td>
  73. <td>(</td>
  74. <td class="paramtype"><a class="el" href="classQCustomPlot.html">QCustomPlot</a> *&#160;</td>
  75. <td class="paramname"><em>parentPlot</em>, </td>
  76. </tr>
  77. <tr>
  78. <td class="paramkey"></td>
  79. <td></td>
  80. <td class="paramtype"><a class="el" href="classQCPAbstractItem.html">QCPAbstractItem</a> *&#160;</td>
  81. <td class="paramname"><em>parentItem</em>, </td>
  82. </tr>
  83. <tr>
  84. <td class="paramkey"></td>
  85. <td></td>
  86. <td class="paramtype">const QString&#160;</td>
  87. <td class="paramname"><em>name</em>, </td>
  88. </tr>
  89. <tr>
  90. <td class="paramkey"></td>
  91. <td></td>
  92. <td class="paramtype">int&#160;</td>
  93. <td class="paramname"><em>anchorId</em> = <code>-1</code>&#160;</td>
  94. </tr>
  95. <tr>
  96. <td></td>
  97. <td>)</td>
  98. <td></td><td></td>
  99. </tr>
  100. </table>
  101. </div><div class="memdoc">
  102. <p>Creates a new <a class="el" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to. ">QCPItemAnchor</a>. You shouldn't create <a class="el" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to. ">QCPItemAnchor</a> instances directly, even if you want to make a new item subclass. Use <a class="el" href="classQCPAbstractItem.html#af3fc92527802078ca395138748b629a7">QCPAbstractItem::createAnchor</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>
  103. </div>
  104. </div>
  105. <h2 class="groupheader">Member Function Documentation</h2>
  106. <a class="anchor" id="ae92def8f9297c5d73f5806c586517bb3"></a>
  107. <div class="memitem">
  108. <div class="memproto">
  109. <table class="mlabels">
  110. <tr>
  111. <td class="mlabels-left">
  112. <table class="memname">
  113. <tr>
  114. <td class="memname">QPointF QCPItemAnchor::pixelPoint </td>
  115. <td>(</td>
  116. <td class="paramname"></td><td>)</td>
  117. <td> const</td>
  118. </tr>
  119. </table>
  120. </td>
  121. <td class="mlabels-right">
  122. <span class="mlabels"><span class="mlabel">virtual</span></span> </td>
  123. </tr>
  124. </table>
  125. </div><div class="memdoc">
  126. <p>Returns the final absolute pixel position of the <a class="el" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to. ">QCPItemAnchor</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.</p>
  127. <p>The pixel information is internally retrieved via QCPAbstractItem::anchorPixelPosition of the parent item, <a class="el" href="classQCPItemAnchor.html" title="An anchor of an item to which positions can be attached to. ">QCPItemAnchor</a> is just an intermediary. </p>
  128. <p>Reimplemented in <a class="el" href="classQCPItemPosition.html#ae490f9c76ee2ba33752c495d3b6e8fb5">QCPItemPosition</a>.</p>
  129. </div>
  130. </div>
  131. <a class="anchor" id="ac54b20120669950255a63587193dbb86"></a>
  132. <div class="memitem">
  133. <div class="memproto">
  134. <table class="mlabels">
  135. <tr>
  136. <td class="mlabels-left">
  137. <table class="memname">
  138. <tr>
  139. <td class="memname"><a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> * QCPItemAnchor::toQCPItemPosition </td>
  140. <td>(</td>
  141. <td class="paramname"></td><td>)</td>
  142. <td></td>
  143. </tr>
  144. </table>
  145. </td>
  146. <td class="mlabels-right">
  147. <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">protected</span><span class="mlabel">virtual</span></span> </td>
  148. </tr>
  149. </table>
  150. </div><div class="memdoc">
  151. <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>
  152. <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>
  153. <p>Reimplemented in <a class="el" href="classQCPItemPosition.html#a577a7efc601df85a20b3e709d1ac320e">QCPItemPosition</a>.</p>
  154. </div>
  155. </div>
  156. <a class="anchor" id="aef15daa640debfb11b0aeaa2116c6fbc"></a>
  157. <div class="memitem">
  158. <div class="memproto">
  159. <table class="mlabels">
  160. <tr>
  161. <td class="mlabels-left">
  162. <table class="memname">
  163. <tr>
  164. <td class="memname">void QCPItemAnchor::addChildX </td>
  165. <td>(</td>
  166. <td class="paramtype"><a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *&#160;</td>
  167. <td class="paramname"><em>pos</em></td><td>)</td>
  168. <td></td>
  169. </tr>
  170. </table>
  171. </td>
  172. <td class="mlabels-right">
  173. <span class="mlabels"><span class="mlabel">protected</span></span> </td>
  174. </tr>
  175. </table>
  176. </div><div class="memdoc">
  177. <p>Adds <em>pos</em> to the childX list of this anchor, which keeps track of which children use this anchor as parent anchor for the respective coordinate. This is necessary to notify the children prior to destruction of the anchor.</p>
  178. <p>Note that this function does not change the parent setting in <em>pos</em>. </p>
  179. </div>
  180. </div>
  181. <a class="anchor" id="a230b1d494cda63458e289bbe1b642599"></a>
  182. <div class="memitem">
  183. <div class="memproto">
  184. <table class="mlabels">
  185. <tr>
  186. <td class="mlabels-left">
  187. <table class="memname">
  188. <tr>
  189. <td class="memname">void QCPItemAnchor::removeChildX </td>
  190. <td>(</td>
  191. <td class="paramtype"><a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *&#160;</td>
  192. <td class="paramname"><em>pos</em></td><td>)</td>
  193. <td></td>
  194. </tr>
  195. </table>
  196. </td>
  197. <td class="mlabels-right">
  198. <span class="mlabels"><span class="mlabel">protected</span></span> </td>
  199. </tr>
  200. </table>
  201. </div><div class="memdoc">
  202. <p>Removes <em>pos</em> from the childX list of this anchor.</p>
  203. <p>Note that this function does not change the parent setting in <em>pos</em>. </p>
  204. </div>
  205. </div>
  206. <a class="anchor" id="af05dc56f24536f0c7a9a0f57b58cea67"></a>
  207. <div class="memitem">
  208. <div class="memproto">
  209. <table class="mlabels">
  210. <tr>
  211. <td class="mlabels-left">
  212. <table class="memname">
  213. <tr>
  214. <td class="memname">void QCPItemAnchor::addChildY </td>
  215. <td>(</td>
  216. <td class="paramtype"><a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *&#160;</td>
  217. <td class="paramname"><em>pos</em></td><td>)</td>
  218. <td></td>
  219. </tr>
  220. </table>
  221. </td>
  222. <td class="mlabels-right">
  223. <span class="mlabels"><span class="mlabel">protected</span></span> </td>
  224. </tr>
  225. </table>
  226. </div><div class="memdoc">
  227. <p>Adds <em>pos</em> to the childY list of this anchor, which keeps track of which children use this anchor as parent anchor for the respective coordinate. This is necessary to notify the children prior to destruction of the anchor.</p>
  228. <p>Note that this function does not change the parent setting in <em>pos</em>. </p>
  229. </div>
  230. </div>
  231. <a class="anchor" id="aa2394911d8fff3bd958b9f4f1994b64d"></a>
  232. <div class="memitem">
  233. <div class="memproto">
  234. <table class="mlabels">
  235. <tr>
  236. <td class="mlabels-left">
  237. <table class="memname">
  238. <tr>
  239. <td class="memname">void QCPItemAnchor::removeChildY </td>
  240. <td>(</td>
  241. <td class="paramtype"><a class="el" href="classQCPItemPosition.html">QCPItemPosition</a> *&#160;</td>
  242. <td class="paramname"><em>pos</em></td><td>)</td>
  243. <td></td>
  244. </tr>
  245. </table>
  246. </td>
  247. <td class="mlabels-right">
  248. <span class="mlabels"><span class="mlabel">protected</span></span> </td>
  249. </tr>
  250. </table>
  251. </div><div class="memdoc">
  252. <p>Removes <em>pos</em> from the childY list of this anchor.</p>
  253. <p>Note that this function does not change the parent setting in <em>pos</em>. </p>
  254. </div>
  255. </div>
  256. <hr/>The documentation for this class was generated from the following files:<ul>
  257. <li>src/item.h</li>
  258. <li>src/item.cpp</li>
  259. </ul>
  260. </div><!-- contents -->
  261. </body>
  262. </html>