|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.Graphics.ClassItem</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.Graphics.ClassItem</h1> |
|
23 <p> |
|
24 Module implementing an UML like class item. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#ClassItem">ClassItem</a></td> |
|
34 <td>Class implementing an UML like class item.</td> |
|
35 </tr><tr> |
|
36 <td><a href="#ClassModel">ClassModel</a></td> |
|
37 <td>Class implementing the class model.</td> |
|
38 </tr> |
|
39 </table> |
|
40 <h3>Functions</h3> |
|
41 <table> |
|
42 <tr><td>None</td></tr> |
|
43 </table> |
|
44 <hr /><hr /> |
|
45 <a NAME="ClassItem" ID="ClassItem"></a> |
|
46 <h2>ClassItem</h2> |
|
47 <p> |
|
48 Class implementing an UML like class item. |
|
49 </p> |
|
50 <h3>Derived from</h3> |
|
51 UMLItem |
|
52 <h3>Class Attributes</h3> |
|
53 <table> |
|
54 <tr><td>ItemType</td></tr> |
|
55 </table> |
|
56 <h3>Class Methods</h3> |
|
57 <table> |
|
58 <tr><td>None</td></tr> |
|
59 </table> |
|
60 <h3>Methods</h3> |
|
61 <table> |
|
62 <tr> |
|
63 <td><a href="#ClassItem.__init__">ClassItem</a></td> |
|
64 <td>Constructor</td> |
|
65 </tr><tr> |
|
66 <td><a href="#ClassItem.__calculateSize">__calculateSize</a></td> |
|
67 <td>Private method to calculate the size of the class item.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#ClassItem.__createTexts">__createTexts</a></td> |
|
70 <td>Private method to create the text items of the class item.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#ClassItem.buildItemDataString">buildItemDataString</a></td> |
|
73 <td>Public method to build a string to persist the specific item data.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#ClassItem.isExternal">isExternal</a></td> |
|
76 <td>Public method returning the external state.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#ClassItem.paint">paint</a></td> |
|
79 <td>Public method to paint the item in local coordinates.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#ClassItem.parseItemDataString">parseItemDataString</a></td> |
|
82 <td>Public method to parse the given persistence data.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#ClassItem.setModel">setModel</a></td> |
|
85 <td>Public method to set the class model.</td> |
|
86 </tr> |
|
87 </table> |
|
88 <h3>Static Methods</h3> |
|
89 <table> |
|
90 <tr><td>None</td></tr> |
|
91 </table> |
|
92 <a NAME="ClassItem.__init__" ID="ClassItem.__init__"></a> |
|
93 <h4>ClassItem (Constructor)</h4> |
|
94 <b>ClassItem</b>(<i>model=None, external=False, x=0, y=0, rounded=False, noAttrs=False, parent=None, scene=None</i>) |
|
95 <p> |
|
96 Constructor |
|
97 </p><dl> |
|
98 <dt><i>model</i></dt> |
|
99 <dd> |
|
100 class model containing the class data (ClassModel) |
|
101 </dd><dt><i>external</i></dt> |
|
102 <dd> |
|
103 flag indicating a class defined outside our scope |
|
104 (boolean) |
|
105 </dd><dt><i>x</i></dt> |
|
106 <dd> |
|
107 x-coordinate (integer) |
|
108 </dd><dt><i>y</i></dt> |
|
109 <dd> |
|
110 y-coordinate (integer) |
|
111 </dd><dt><i>rounded=</i></dt> |
|
112 <dd> |
|
113 flag indicating a rounded corner (boolean) |
|
114 </dd><dt><i>noAttrs=</i></dt> |
|
115 <dd> |
|
116 flag indicating, that no attributes should be shown |
|
117 (boolean) |
|
118 </dd><dt><i>parent=</i></dt> |
|
119 <dd> |
|
120 reference to the parent object (QGraphicsItem) |
|
121 </dd><dt><i>scene=</i></dt> |
|
122 <dd> |
|
123 reference to the scene object (QGraphicsScene) |
|
124 </dd> |
|
125 </dl><a NAME="ClassItem.__calculateSize" ID="ClassItem.__calculateSize"></a> |
|
126 <h4>ClassItem.__calculateSize</h4> |
|
127 <b>__calculateSize</b>(<i></i>) |
|
128 <p> |
|
129 Private method to calculate the size of the class item. |
|
130 </p><a NAME="ClassItem.__createTexts" ID="ClassItem.__createTexts"></a> |
|
131 <h4>ClassItem.__createTexts</h4> |
|
132 <b>__createTexts</b>(<i></i>) |
|
133 <p> |
|
134 Private method to create the text items of the class item. |
|
135 </p><a NAME="ClassItem.buildItemDataString" ID="ClassItem.buildItemDataString"></a> |
|
136 <h4>ClassItem.buildItemDataString</h4> |
|
137 <b>buildItemDataString</b>(<i></i>) |
|
138 <p> |
|
139 Public method to build a string to persist the specific item data. |
|
140 </p><p> |
|
141 This string must start with ", " and should be built like |
|
142 "attribute=value" with pairs separated by ", ". value must not |
|
143 contain ", " or newlines. |
|
144 </p><dl> |
|
145 <dt>Returns:</dt> |
|
146 <dd> |
|
147 persistence data (string) |
|
148 </dd> |
|
149 </dl><a NAME="ClassItem.isExternal" ID="ClassItem.isExternal"></a> |
|
150 <h4>ClassItem.isExternal</h4> |
|
151 <b>isExternal</b>(<i></i>) |
|
152 <p> |
|
153 Public method returning the external state. |
|
154 </p><dl> |
|
155 <dt>Returns:</dt> |
|
156 <dd> |
|
157 external state (boolean) |
|
158 </dd> |
|
159 </dl><a NAME="ClassItem.paint" ID="ClassItem.paint"></a> |
|
160 <h4>ClassItem.paint</h4> |
|
161 <b>paint</b>(<i>painter, option, widget=None</i>) |
|
162 <p> |
|
163 Public method to paint the item in local coordinates. |
|
164 </p><dl> |
|
165 <dt><i>painter</i></dt> |
|
166 <dd> |
|
167 reference to the painter object (QPainter) |
|
168 </dd><dt><i>option</i></dt> |
|
169 <dd> |
|
170 style options (QStyleOptionGraphicsItem) |
|
171 </dd><dt><i>widget</i></dt> |
|
172 <dd> |
|
173 optional reference to the widget painted on (QWidget) |
|
174 </dd> |
|
175 </dl><a NAME="ClassItem.parseItemDataString" ID="ClassItem.parseItemDataString"></a> |
|
176 <h4>ClassItem.parseItemDataString</h4> |
|
177 <b>parseItemDataString</b>(<i>version, data</i>) |
|
178 <p> |
|
179 Public method to parse the given persistence data. |
|
180 </p><dl> |
|
181 <dt><i>version</i></dt> |
|
182 <dd> |
|
183 version of the data (string) |
|
184 </dd><dt><i>data</i></dt> |
|
185 <dd> |
|
186 persisted data to be parsed (string) |
|
187 </dd> |
|
188 </dl><dl> |
|
189 <dt>Returns:</dt> |
|
190 <dd> |
|
191 flag indicating success (boolean) |
|
192 </dd> |
|
193 </dl><a NAME="ClassItem.setModel" ID="ClassItem.setModel"></a> |
|
194 <h4>ClassItem.setModel</h4> |
|
195 <b>setModel</b>(<i>model</i>) |
|
196 <p> |
|
197 Public method to set the class model. |
|
198 </p><dl> |
|
199 <dt><i>model</i></dt> |
|
200 <dd> |
|
201 class model containing the class data (ClassModel) |
|
202 </dd> |
|
203 </dl> |
|
204 <div align="right"><a href="#top">Up</a></div> |
|
205 <hr /><hr /> |
|
206 <a NAME="ClassModel" ID="ClassModel"></a> |
|
207 <h2>ClassModel</h2> |
|
208 <p> |
|
209 Class implementing the class model. |
|
210 </p> |
|
211 <h3>Derived from</h3> |
|
212 UMLModel |
|
213 <h3>Class Attributes</h3> |
|
214 <table> |
|
215 <tr><td>None</td></tr> |
|
216 </table> |
|
217 <h3>Class Methods</h3> |
|
218 <table> |
|
219 <tr><td>None</td></tr> |
|
220 </table> |
|
221 <h3>Methods</h3> |
|
222 <table> |
|
223 <tr> |
|
224 <td><a href="#ClassModel.__init__">ClassModel</a></td> |
|
225 <td>Constructor</td> |
|
226 </tr><tr> |
|
227 <td><a href="#ClassModel.addAttribute">addAttribute</a></td> |
|
228 <td>Public method to add an attribute to the class model.</td> |
|
229 </tr><tr> |
|
230 <td><a href="#ClassModel.addMethod">addMethod</a></td> |
|
231 <td>Public method to add a method to the class model.</td> |
|
232 </tr><tr> |
|
233 <td><a href="#ClassModel.getAttributes">getAttributes</a></td> |
|
234 <td>Public method to retrieve the attributes of the class.</td> |
|
235 </tr><tr> |
|
236 <td><a href="#ClassModel.getMethods">getMethods</a></td> |
|
237 <td>Public method to retrieve the methods of the class.</td> |
|
238 </tr> |
|
239 </table> |
|
240 <h3>Static Methods</h3> |
|
241 <table> |
|
242 <tr><td>None</td></tr> |
|
243 </table> |
|
244 <a NAME="ClassModel.__init__" ID="ClassModel.__init__"></a> |
|
245 <h4>ClassModel (Constructor)</h4> |
|
246 <b>ClassModel</b>(<i>name, methods=None, attributes=None</i>) |
|
247 <p> |
|
248 Constructor |
|
249 </p><dl> |
|
250 <dt><i>name</i></dt> |
|
251 <dd> |
|
252 the class name (string) |
|
253 </dd><dt><i>methods</i></dt> |
|
254 <dd> |
|
255 list of method names of the class |
|
256 (list of strings) |
|
257 </dd><dt><i>attributes</i></dt> |
|
258 <dd> |
|
259 list of attribute names of the class |
|
260 (list of strings) |
|
261 </dd> |
|
262 </dl><a NAME="ClassModel.addAttribute" ID="ClassModel.addAttribute"></a> |
|
263 <h4>ClassModel.addAttribute</h4> |
|
264 <b>addAttribute</b>(<i>attribute</i>) |
|
265 <p> |
|
266 Public method to add an attribute to the class model. |
|
267 </p><dl> |
|
268 <dt><i>attribute</i></dt> |
|
269 <dd> |
|
270 attribute name to be added (string) |
|
271 </dd> |
|
272 </dl><a NAME="ClassModel.addMethod" ID="ClassModel.addMethod"></a> |
|
273 <h4>ClassModel.addMethod</h4> |
|
274 <b>addMethod</b>(<i>method</i>) |
|
275 <p> |
|
276 Public method to add a method to the class model. |
|
277 </p><dl> |
|
278 <dt><i>method</i></dt> |
|
279 <dd> |
|
280 method name to be added (string) |
|
281 </dd> |
|
282 </dl><a NAME="ClassModel.getAttributes" ID="ClassModel.getAttributes"></a> |
|
283 <h4>ClassModel.getAttributes</h4> |
|
284 <b>getAttributes</b>(<i></i>) |
|
285 <p> |
|
286 Public method to retrieve the attributes of the class. |
|
287 </p><dl> |
|
288 <dt>Returns:</dt> |
|
289 <dd> |
|
290 list of class attributes (list of strings) |
|
291 </dd> |
|
292 </dl><a NAME="ClassModel.getMethods" ID="ClassModel.getMethods"></a> |
|
293 <h4>ClassModel.getMethods</h4> |
|
294 <b>getMethods</b>(<i></i>) |
|
295 <p> |
|
296 Public method to retrieve the methods of the class. |
|
297 </p><dl> |
|
298 <dt>Returns:</dt> |
|
299 <dd> |
|
300 list of class methods (list of strings) |
|
301 </dd> |
|
302 </dl> |
|
303 <div align="right"><a href="#top">Up</a></div> |
|
304 <hr /> |
|
305 </body></html> |