classQCPMarginGroup.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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>QCPMarginGroup 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">QCPMarginGroup Class Reference</div> </div>
  25. </div><!--header-->
  26. <div class="contents">
  27. <p>A margin group allows synchronization of margin sides if working with multiple layout elements.
  28. <a href="classQCPMarginGroup.html#details">More...</a></p>
  29. <p>Inherits QObject.</p>
  30. <table class="memberdecls">
  31. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
  32. Public Functions</h2></td></tr>
  33. <tr class="memitem:ac481c20678ec5b305d6df330715f4b7b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPMarginGroup.html#ac481c20678ec5b305d6df330715f4b7b">QCPMarginGroup</a> (<a class="el" href="classQCustomPlot.html">QCustomPlot</a> *parentPlot)</td></tr>
  34. <tr class="separator:ac481c20678ec5b305d6df330715f4b7b"><td class="memSeparator" colspan="2">&#160;</td></tr>
  35. <tr class="memitem:a2f39e319c9ece34e0392c2ca350f1069"><td class="memItemLeft" align="right" valign="top">QList&lt; <a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> * &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPMarginGroup.html#a2f39e319c9ece34e0392c2ca350f1069">elements</a> (<a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a> side) const </td></tr>
  36. <tr class="separator:a2f39e319c9ece34e0392c2ca350f1069"><td class="memSeparator" colspan="2">&#160;</td></tr>
  37. <tr class="memitem:a28c8e87a0b87c01bd28c693faabddd7b"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPMarginGroup.html#a28c8e87a0b87c01bd28c693faabddd7b">isEmpty</a> () const </td></tr>
  38. <tr class="separator:a28c8e87a0b87c01bd28c693faabddd7b"><td class="memSeparator" colspan="2">&#160;</td></tr>
  39. <tr class="memitem:a144b67f216e4e86c3a3a309e850285fe"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPMarginGroup.html#a144b67f216e4e86c3a3a309e850285fe">clear</a> ()</td></tr>
  40. <tr class="separator:a144b67f216e4e86c3a3a309e850285fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
  41. </table><table class="memberdecls">
  42. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
  43. Protected Functions</h2></td></tr>
  44. <tr class="memitem:aeaeba9068dba2ef8be41449f0f2582f7"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPMarginGroup.html#aeaeba9068dba2ef8be41449f0f2582f7">commonMargin</a> (<a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a> side) const </td></tr>
  45. <tr class="separator:aeaeba9068dba2ef8be41449f0f2582f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
  46. <tr class="memitem:acb9c3a35acec655c2895b7eb95ee0524"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPMarginGroup.html#acb9c3a35acec655c2895b7eb95ee0524">addChild</a> (<a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a> side, <a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> *element)</td></tr>
  47. <tr class="separator:acb9c3a35acec655c2895b7eb95ee0524"><td class="memSeparator" colspan="2">&#160;</td></tr>
  48. <tr class="memitem:a20ab3286062957d99b58db683fe725b0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classQCPMarginGroup.html#a20ab3286062957d99b58db683fe725b0">removeChild</a> (<a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a> side, <a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> *element)</td></tr>
  49. <tr class="separator:a20ab3286062957d99b58db683fe725b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
  50. </table>
  51. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  52. <div class="textblock"><p>A margin group allows synchronization of margin sides if working with multiple layout elements. </p>
  53. <p><a class="el" href="classQCPMarginGroup.html" title="A margin group allows synchronization of margin sides if working with multiple layout elements...">QCPMarginGroup</a> allows you to tie a margin side of two or more layout elements together, such that they will all have the same size, based on the largest required margin in the group.</p>
  54. <p><br/>
  55. </p>
  56. <div class="image">
  57. <img src="QCPMarginGroup.png" alt="QCPMarginGroup.png"/>
  58. <div class="caption">
  59. Demonstration of QCPMarginGroup</div></div>
  60. <p><br/>
  61. In certain situations it is desirable that margins at specific sides are synchronized across layout elements. For example, if one <a class="el" href="classQCPAxisRect.html" title="Holds multiple axes and arranges them in a rectangular shape. ">QCPAxisRect</a> is below another one in a grid layout, it will provide a cleaner look to the user if the left and right margins of the two axis rects are of the same size. The left axis of the top axis rect will then be at the same horizontal position as the left axis of the lower axis rect, making them appear aligned. The same applies for the right axes. This is what <a class="el" href="classQCPMarginGroup.html" title="A margin group allows synchronization of margin sides if working with multiple layout elements...">QCPMarginGroup</a> makes possible.</p>
  62. <p>To add/remove a specific side of a layout element to/from a margin group, use the <a class="el" href="classQCPLayoutElement.html#a516e56f76b6bc100e8e71d329866847d">QCPLayoutElement::setMarginGroup</a> method. To completely break apart the margin group, either call <a class="el" href="classQCPMarginGroup.html#a144b67f216e4e86c3a3a309e850285fe">clear</a>, or just delete the margin group.</p>
  63. <h1><a class="anchor" id="QCPMarginGroup-example"></a>
  64. Example</h1>
  65. <p>First create a margin group: </p>
  66. <div class="fragment"><div class="line"> <a class="code" href="classQCPMarginGroup.html">QCPMarginGroup</a> *group = <span class="keyword">new</span> <a class="code" href="classQCPMarginGroup.html#ac481c20678ec5b305d6df330715f4b7b">QCPMarginGroup</a>(customPlot);</div>
  67. </div><!-- fragment --><p>Then set this group on the layout element sides: </p>
  68. <div class="fragment"><div class="line"> customPlot-&gt;axisRect(0)-&gt;setMarginGroup(<a class="code" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54a9500c8bfcc9e80b9dff0a8e00e867f07">QCP::msLeft</a>|<a class="code" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54a93c719593bb2b94ed244d52c86d83b65">QCP::msRight</a>, group);</div>
  69. <div class="line"> customPlot-&gt;axisRect(1)-&gt;setMarginGroup(<a class="code" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54a9500c8bfcc9e80b9dff0a8e00e867f07">QCP::msLeft</a>|<a class="code" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54a93c719593bb2b94ed244d52c86d83b65">QCP::msRight</a>, group);</div>
  70. </div><!-- fragment --><p>Here, we've used the first two axis rects of the plot and synchronized their left margins with each other and their right margins with each other. </p>
  71. </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
  72. <a class="anchor" id="ac481c20678ec5b305d6df330715f4b7b"></a>
  73. <div class="memitem">
  74. <div class="memproto">
  75. <table class="memname">
  76. <tr>
  77. <td class="memname">QCPMarginGroup::QCPMarginGroup </td>
  78. <td>(</td>
  79. <td class="paramtype"><a class="el" href="classQCustomPlot.html">QCustomPlot</a> *&#160;</td>
  80. <td class="paramname"><em>parentPlot</em></td><td>)</td>
  81. <td></td>
  82. </tr>
  83. </table>
  84. </div><div class="memdoc">
  85. <p>Creates a new <a class="el" href="classQCPMarginGroup.html" title="A margin group allows synchronization of margin sides if working with multiple layout elements...">QCPMarginGroup</a> instance in <em>parentPlot</em>. </p>
  86. </div>
  87. </div>
  88. <h2 class="groupheader">Member Function Documentation</h2>
  89. <a class="anchor" id="a2f39e319c9ece34e0392c2ca350f1069"></a>
  90. <div class="memitem">
  91. <div class="memproto">
  92. <table class="mlabels">
  93. <tr>
  94. <td class="mlabels-left">
  95. <table class="memname">
  96. <tr>
  97. <td class="memname">QList&lt; <a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> * &gt; QCPMarginGroup::elements </td>
  98. <td>(</td>
  99. <td class="paramtype"><a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a>&#160;</td>
  100. <td class="paramname"><em>side</em></td><td>)</td>
  101. <td> const</td>
  102. </tr>
  103. </table>
  104. </td>
  105. <td class="mlabels-right">
  106. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  107. </tr>
  108. </table>
  109. </div><div class="memdoc">
  110. <p>Returns a list of all layout elements that have their margin <em>side</em> associated with this margin group. </p>
  111. </div>
  112. </div>
  113. <a class="anchor" id="a28c8e87a0b87c01bd28c693faabddd7b"></a>
  114. <div class="memitem">
  115. <div class="memproto">
  116. <table class="memname">
  117. <tr>
  118. <td class="memname">bool QCPMarginGroup::isEmpty </td>
  119. <td>(</td>
  120. <td class="paramname"></td><td>)</td>
  121. <td> const</td>
  122. </tr>
  123. </table>
  124. </div><div class="memdoc">
  125. <p>Returns whether this margin group is empty. If this function returns true, no layout elements use this margin group to synchronize margin sides. </p>
  126. </div>
  127. </div>
  128. <a class="anchor" id="a144b67f216e4e86c3a3a309e850285fe"></a>
  129. <div class="memitem">
  130. <div class="memproto">
  131. <table class="memname">
  132. <tr>
  133. <td class="memname">void QCPMarginGroup::clear </td>
  134. <td>(</td>
  135. <td class="paramname"></td><td>)</td>
  136. <td></td>
  137. </tr>
  138. </table>
  139. </div><div class="memdoc">
  140. <p>Clears this margin group. The synchronization of the margin sides that use this margin group is lifted and they will use their individual margin sizes again. </p>
  141. </div>
  142. </div>
  143. <a class="anchor" id="aeaeba9068dba2ef8be41449f0f2582f7"></a>
  144. <div class="memitem">
  145. <div class="memproto">
  146. <table class="mlabels">
  147. <tr>
  148. <td class="mlabels-left">
  149. <table class="memname">
  150. <tr>
  151. <td class="memname">int QCPMarginGroup::commonMargin </td>
  152. <td>(</td>
  153. <td class="paramtype"><a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a>&#160;</td>
  154. <td class="paramname"><em>side</em></td><td>)</td>
  155. <td> const</td>
  156. </tr>
  157. </table>
  158. </td>
  159. <td class="mlabels-right">
  160. <span class="mlabels"><span class="mlabel">protected</span></span> </td>
  161. </tr>
  162. </table>
  163. </div><div class="memdoc">
  164. <p>Returns the synchronized common margin for <em>side</em>. This is the margin value that will be used by the layout element on the respective side, if it is part of this margin group.</p>
  165. <p>The common margin is calculated by requesting the automatic margin (<a class="el" href="classQCPLayoutElement.html#a005c9f0fe84bc1591a2cf2c46fd477b4">QCPLayoutElement::calculateAutoMargin</a>) of each element associated with <em>side</em> in this margin group, and choosing the largest returned value. (QCPLayoutElement::minimumMargins is taken into account, too.) </p>
  166. </div>
  167. </div>
  168. <a class="anchor" id="acb9c3a35acec655c2895b7eb95ee0524"></a>
  169. <div class="memitem">
  170. <div class="memproto">
  171. <table class="mlabels">
  172. <tr>
  173. <td class="mlabels-left">
  174. <table class="memname">
  175. <tr>
  176. <td class="memname">void QCPMarginGroup::addChild </td>
  177. <td>(</td>
  178. <td class="paramtype"><a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a>&#160;</td>
  179. <td class="paramname"><em>side</em>, </td>
  180. </tr>
  181. <tr>
  182. <td class="paramkey"></td>
  183. <td></td>
  184. <td class="paramtype"><a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> *&#160;</td>
  185. <td class="paramname"><em>element</em>&#160;</td>
  186. </tr>
  187. <tr>
  188. <td></td>
  189. <td>)</td>
  190. <td></td><td></td>
  191. </tr>
  192. </table>
  193. </td>
  194. <td class="mlabels-right">
  195. <span class="mlabels"><span class="mlabel">protected</span></span> </td>
  196. </tr>
  197. </table>
  198. </div><div class="memdoc">
  199. <p>Adds <em>element</em> to the internal list of child elements, for the margin <em>side</em>.</p>
  200. <p>This function does not modify the margin group property of <em>element</em>. </p>
  201. </div>
  202. </div>
  203. <a class="anchor" id="a20ab3286062957d99b58db683fe725b0"></a>
  204. <div class="memitem">
  205. <div class="memproto">
  206. <table class="mlabels">
  207. <tr>
  208. <td class="mlabels-left">
  209. <table class="memname">
  210. <tr>
  211. <td class="memname">void QCPMarginGroup::removeChild </td>
  212. <td>(</td>
  213. <td class="paramtype"><a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a>&#160;</td>
  214. <td class="paramname"><em>side</em>, </td>
  215. </tr>
  216. <tr>
  217. <td class="paramkey"></td>
  218. <td></td>
  219. <td class="paramtype"><a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> *&#160;</td>
  220. <td class="paramname"><em>element</em>&#160;</td>
  221. </tr>
  222. <tr>
  223. <td></td>
  224. <td>)</td>
  225. <td></td><td></td>
  226. </tr>
  227. </table>
  228. </td>
  229. <td class="mlabels-right">
  230. <span class="mlabels"><span class="mlabel">protected</span></span> </td>
  231. </tr>
  232. </table>
  233. </div><div class="memdoc">
  234. <p>Removes <em>element</em> from the internal list of child elements, for the margin <em>side</em>.</p>
  235. <p>This function does not modify the margin group property of <em>element</em>. </p>
  236. </div>
  237. </div>
  238. <hr/>The documentation for this class was generated from the following files:<ul>
  239. <li>src/layout.h</li>
  240. <li>src/layout.cpp</li>
  241. </ul>
  242. </div><!-- contents -->
  243. </body>
  244. </html>