File: classQCPMarginGroup.html

package info (click to toggle)
qcustomplot 1.3.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,112 kB
  • ctags: 2,361
  • sloc: cpp: 17,354; sh: 1,555; makefile: 2
file content (253 lines) | stat: -rw-r--r-- 15,041 bytes parent folder | download
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
<!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"/>
<meta name="author" content="Emanuel Eichhammer" />
<meta name="copyright" content="(C) 2013-2015 Emanuel Eichhammer" />
<title>QCPMarginGroup Class Reference</title>
<link href="qt.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top">
<a class="headerLink"  href="index.html">Main Page</a> &middot;
<a class="headerLink"  href="classoverview.html">Class Overview</a> &middot;
<a class="headerLink"  href="hierarchy.html">Hierarchy</a> &middot;
<a class="headerLink"  href="annotated.html">All Classes</a> &middot;
<a class="headerLink"  href="pages.html">Special Pages</a>
<!-- Generated by Doxygen 1.8.6 -->
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Functions</a> &#124;
<a href="#pro-methods">Protected Functions</a>  </div>
  <div class="headertitle">
<div class="title">QCPMarginGroup Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A margin group allows synchronization of margin sides if working with multiple layout elements.  
 <a href="classQCPMarginGroup.html#details">More...</a></p>

<p>Inherits QObject.</p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Functions</h2></td></tr>
<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>
<tr class="separator:ac481c20678ec5b305d6df330715f4b7b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<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>
<tr class="separator:a2f39e319c9ece34e0392c2ca350f1069"><td class="memSeparator" colspan="2">&#160;</td></tr>
<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>
<tr class="separator:a28c8e87a0b87c01bd28c693faabddd7b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<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>
<tr class="separator:a144b67f216e4e86c3a3a309e850285fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Functions</h2></td></tr>
<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>
<tr class="separator:aeaeba9068dba2ef8be41449f0f2582f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<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>
<tr class="separator:acb9c3a35acec655c2895b7eb95ee0524"><td class="memSeparator" colspan="2">&#160;</td></tr>
<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>
<tr class="separator:a20ab3286062957d99b58db683fe725b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A margin group allows synchronization of margin sides if working with multiple layout elements. </p>
<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>
<p><br/>
</p>
<div class="image">
<img src="QCPMarginGroup.png" alt="QCPMarginGroup.png"/>
<div class="caption">
Demonstration of QCPMarginGroup</div></div>
<p><br/>
 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>
<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>
<h1><a class="anchor" id="QCPMarginGroup-example"></a>
Example</h1>
<p>First create a margin group: </p>
<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>
</div><!-- fragment --><p>Then set this group on the layout element sides: </p>
<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>
<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>
</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>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ac481c20678ec5b305d6df330715f4b7b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QCPMarginGroup::QCPMarginGroup </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classQCustomPlot.html">QCustomPlot</a> *&#160;</td>
          <td class="paramname"><em>parentPlot</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<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>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a2f39e319c9ece34e0392c2ca350f1069"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">QList&lt; <a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> * &gt; QCPMarginGroup::elements </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a>&#160;</td>
          <td class="paramname"><em>side</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Returns a list of all layout elements that have their margin <em>side</em> associated with this margin group. </p>

</div>
</div>
<a class="anchor" id="a28c8e87a0b87c01bd28c693faabddd7b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool QCPMarginGroup::isEmpty </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<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>

</div>
</div>
<a class="anchor" id="a144b67f216e4e86c3a3a309e850285fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void QCPMarginGroup::clear </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<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>

</div>
</div>
<a class="anchor" id="aeaeba9068dba2ef8be41449f0f2582f7"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int QCPMarginGroup::commonMargin </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a>&#160;</td>
          <td class="paramname"><em>side</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<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>
<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>

</div>
</div>
<a class="anchor" id="acb9c3a35acec655c2895b7eb95ee0524"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void QCPMarginGroup::addChild </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a>&#160;</td>
          <td class="paramname"><em>side</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> *&#160;</td>
          <td class="paramname"><em>element</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Adds <em>element</em> to the internal list of child elements, for the margin <em>side</em>.</p>
<p>This function does not modify the margin group property of <em>element</em>. </p>

</div>
</div>
<a class="anchor" id="a20ab3286062957d99b58db683fe725b0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void QCPMarginGroup::removeChild </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceQCP.html#a7e487e3e2ccb62ab7771065bab7cae54">QCP::MarginSide</a>&#160;</td>
          <td class="paramname"><em>side</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classQCPLayoutElement.html">QCPLayoutElement</a> *&#160;</td>
          <td class="paramname"><em>element</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Removes <em>element</em> from the internal list of child elements, for the margin <em>side</em>.</p>
<p>This function does not modify the margin group property of <em>element</em>. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/layout.h</li>
<li>src/layout.cpp</li>
</ul>
</div><!-- contents -->
</body>
</html>