eric7/Documentation/Source/eric7.Graphics.UMLItem.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Graphics.UMLItem</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>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.Graphics.UMLItem</h1>
24
25 <p>
26 Module implementing the UMLItem base class.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36
37 <tr>
38 <td><a href="#UMLItem">UMLItem</a></td>
39 <td>Class implementing the UMLItem base class.</td>
40 </tr>
41 <tr>
42 <td><a href="#UMLModel">UMLModel</a></td>
43 <td>Class implementing the UMLModel base class.</td>
44 </tr>
45 </table>
46 <h3>Functions</h3>
47
48 <table>
49 <tr><td>None</td></tr>
50 </table>
51 <hr />
52 <hr />
53 <a NAME="UMLItem" ID="UMLItem"></a>
54 <h2>UMLItem</h2>
55
56 <p>
57 Class implementing the UMLItem base class.
58 </p>
59 <h3>Derived from</h3>
60 QGraphicsRectItem
61 <h3>Class Attributes</h3>
62
63 <table>
64 <tr><td>ItemType</td></tr>
65 </table>
66 <h3>Class Methods</h3>
67
68 <table>
69
70 <tr>
71 <td><a href="#UMLItem.fromDict">fromDict</a></td>
72 <td>Class method to create a generic UML item from persisted data.</td>
73 </tr>
74 </table>
75 <h3>Methods</h3>
76
77 <table>
78
79 <tr>
80 <td><a href="#UMLItem.__init__">UMLItem</a></td>
81 <td>Constructor</td>
82 </tr>
83 <tr>
84 <td><a href="#UMLItem.addAssociation">addAssociation</a></td>
85 <td>Public method to add an association to this widget.</td>
86 </tr>
87 <tr>
88 <td><a href="#UMLItem.adjustAssociations">adjustAssociations</a></td>
89 <td>Public method to adjust the associations to widget movements.</td>
90 </tr>
91 <tr>
92 <td><a href="#UMLItem.getId">getId</a></td>
93 <td>Public method to get the item ID.</td>
94 </tr>
95 <tr>
96 <td><a href="#UMLItem.getItemType">getItemType</a></td>
97 <td>Public method to get the item's type.</td>
98 </tr>
99 <tr>
100 <td><a href="#UMLItem.getName">getName</a></td>
101 <td>Public method to retrieve the item name.</td>
102 </tr>
103 <tr>
104 <td><a href="#UMLItem.itemChange">itemChange</a></td>
105 <td>Public method called when an items state changes.</td>
106 </tr>
107 <tr>
108 <td><a href="#UMLItem.moveBy">moveBy</a></td>
109 <td>Public overriden method to move the widget relative.</td>
110 </tr>
111 <tr>
112 <td><a href="#UMLItem.paint">paint</a></td>
113 <td>Public method to paint the item in local coordinates.</td>
114 </tr>
115 <tr>
116 <td><a href="#UMLItem.parseItemDataString">parseItemDataString</a></td>
117 <td>Public method to parse the given persistence data.</td>
118 </tr>
119 <tr>
120 <td><a href="#UMLItem.removeAssociation">removeAssociation</a></td>
121 <td>Public method to remove an association to this widget.</td>
122 </tr>
123 <tr>
124 <td><a href="#UMLItem.removeAssociations">removeAssociations</a></td>
125 <td>Public method to remove all associations of this widget.</td>
126 </tr>
127 <tr>
128 <td><a href="#UMLItem.setId">setId</a></td>
129 <td>Public method to assign an ID to the item.</td>
130 </tr>
131 <tr>
132 <td><a href="#UMLItem.setPos">setPos</a></td>
133 <td>Public overriden method to set the items position.</td>
134 </tr>
135 <tr>
136 <td><a href="#UMLItem.setSize">setSize</a></td>
137 <td>Public method to set the rectangles size.</td>
138 </tr>
139 <tr>
140 <td><a href="#UMLItem.toDict">toDict</a></td>
141 <td>Public method to collect data to be persisted.</td>
142 </tr>
143 </table>
144 <h3>Static Methods</h3>
145
146 <table>
147 <tr><td>None</td></tr>
148 </table>
149
150 <a NAME="UMLItem.fromDict" ID="UMLItem.fromDict"></a>
151 <h4>UMLItem.fromDict (class method)</h4>
152 <b>fromDict</b>(<i>data, colors=None</i>)
153
154 <p>
155 Class method to create a generic UML item from persisted data.
156 </p>
157 <dl>
158
159 <dt><i>data</i> (dict)</dt>
160 <dd>
161 dictionary containing the persisted data as generated
162 by toDict()
163 </dd>
164 <dt><i>colors</i> (tuple of (QColor, QColor))</dt>
165 <dd>
166 tuple containing the foreground and background colors
167 </dd>
168 </dl>
169 <dl>
170 <dt>Return:</dt>
171 <dd>
172 created UML item
173 </dd>
174 </dl>
175 <dl>
176 <dt>Return Type:</dt>
177 <dd>
178 UMLItem
179 </dd>
180 </dl>
181 <a NAME="UMLItem.__init__" ID="UMLItem.__init__"></a>
182 <h4>UMLItem (Constructor)</h4>
183 <b>UMLItem</b>(<i>model=None, x=0, y=0, rounded=False, colors=None, parent=None</i>)
184
185 <p>
186 Constructor
187 </p>
188 <dl>
189
190 <dt><i>model</i> (UMLModel)</dt>
191 <dd>
192 UML model containing the item data
193 </dd>
194 <dt><i>x</i> (int)</dt>
195 <dd>
196 x-coordinate
197 </dd>
198 <dt><i>y</i> (int)</dt>
199 <dd>
200 y-coordinate
201 </dd>
202 <dt><i>rounded</i> (bool)</dt>
203 <dd>
204 flag indicating a rounded corner
205 </dd>
206 <dt><i>colors</i> (tuple of (QColor, QColor))</dt>
207 <dd>
208 tuple containing the foreground and background colors
209 </dd>
210 <dt><i>parent</i> (QGraphicsItem)</dt>
211 <dd>
212 reference to the parent object
213 </dd>
214 </dl>
215 <a NAME="UMLItem.addAssociation" ID="UMLItem.addAssociation"></a>
216 <h4>UMLItem.addAssociation</h4>
217 <b>addAssociation</b>(<i>assoc</i>)
218
219 <p>
220 Public method to add an association to this widget.
221 </p>
222 <dl>
223
224 <dt><i>assoc</i> (AssociationWidget)</dt>
225 <dd>
226 association to be added
227 </dd>
228 </dl>
229 <a NAME="UMLItem.adjustAssociations" ID="UMLItem.adjustAssociations"></a>
230 <h4>UMLItem.adjustAssociations</h4>
231 <b>adjustAssociations</b>(<i></i>)
232
233 <p>
234 Public method to adjust the associations to widget movements.
235 </p>
236 <a NAME="UMLItem.getId" ID="UMLItem.getId"></a>
237 <h4>UMLItem.getId</h4>
238 <b>getId</b>(<i></i>)
239
240 <p>
241 Public method to get the item ID.
242 </p>
243 <dl>
244 <dt>Return:</dt>
245 <dd>
246 ID of the item
247 </dd>
248 </dl>
249 <dl>
250 <dt>Return Type:</dt>
251 <dd>
252 int
253 </dd>
254 </dl>
255 <a NAME="UMLItem.getItemType" ID="UMLItem.getItemType"></a>
256 <h4>UMLItem.getItemType</h4>
257 <b>getItemType</b>(<i></i>)
258
259 <p>
260 Public method to get the item's type.
261 </p>
262 <dl>
263 <dt>Return:</dt>
264 <dd>
265 item type
266 </dd>
267 </dl>
268 <dl>
269 <dt>Return Type:</dt>
270 <dd>
271 str
272 </dd>
273 </dl>
274 <a NAME="UMLItem.getName" ID="UMLItem.getName"></a>
275 <h4>UMLItem.getName</h4>
276 <b>getName</b>(<i></i>)
277
278 <p>
279 Public method to retrieve the item name.
280 </p>
281 <dl>
282 <dt>Return:</dt>
283 <dd>
284 item name
285 </dd>
286 </dl>
287 <dl>
288 <dt>Return Type:</dt>
289 <dd>
290 str
291 </dd>
292 </dl>
293 <a NAME="UMLItem.itemChange" ID="UMLItem.itemChange"></a>
294 <h4>UMLItem.itemChange</h4>
295 <b>itemChange</b>(<i>change, value</i>)
296
297 <p>
298 Public method called when an items state changes.
299 </p>
300 <dl>
301
302 <dt><i>change</i> (QGraphicsItem.GraphicsItemChange)</dt>
303 <dd>
304 the item's change
305 </dd>
306 <dt><i>value</i></dt>
307 <dd>
308 the value of the change
309 </dd>
310 </dl>
311 <dl>
312 <dt>Return:</dt>
313 <dd>
314 adjusted values
315 </dd>
316 </dl>
317 <a NAME="UMLItem.moveBy" ID="UMLItem.moveBy"></a>
318 <h4>UMLItem.moveBy</h4>
319 <b>moveBy</b>(<i>dx, dy</i>)
320
321 <p>
322 Public overriden method to move the widget relative.
323 </p>
324 <dl>
325
326 <dt><i>dx</i> (float)</dt>
327 <dd>
328 relative movement in x-direction
329 </dd>
330 <dt><i>dy</i> (float)</dt>
331 <dd>
332 relative movement in y-direction
333 </dd>
334 </dl>
335 <a NAME="UMLItem.paint" ID="UMLItem.paint"></a>
336 <h4>UMLItem.paint</h4>
337 <b>paint</b>(<i>painter, option, widget=None</i>)
338
339 <p>
340 Public method to paint the item in local coordinates.
341 </p>
342 <dl>
343
344 <dt><i>painter</i> (QPainter)</dt>
345 <dd>
346 reference to the painter object
347 </dd>
348 <dt><i>option</i> (QStyleOptionGraphicsItem)</dt>
349 <dd>
350 style options
351 </dd>
352 <dt><i>widget</i> (QWidget)</dt>
353 <dd>
354 optional reference to the widget painted on
355 </dd>
356 </dl>
357 <a NAME="UMLItem.parseItemDataString" ID="UMLItem.parseItemDataString"></a>
358 <h4>UMLItem.parseItemDataString</h4>
359 <b>parseItemDataString</b>(<i>version, data</i>)
360
361 <p>
362 Public method to parse the given persistence data.
363 </p>
364 <dl>
365
366 <dt><i>version</i> (str)</dt>
367 <dd>
368 version of the data
369 </dd>
370 <dt><i>data</i> (str)</dt>
371 <dd>
372 persisted data to be parsed
373 </dd>
374 </dl>
375 <dl>
376 <dt>Return:</dt>
377 <dd>
378 flag indicating success
379 </dd>
380 </dl>
381 <dl>
382 <dt>Return Type:</dt>
383 <dd>
384 bool
385 </dd>
386 </dl>
387 <a NAME="UMLItem.removeAssociation" ID="UMLItem.removeAssociation"></a>
388 <h4>UMLItem.removeAssociation</h4>
389 <b>removeAssociation</b>(<i>assoc</i>)
390
391 <p>
392 Public method to remove an association to this widget.
393 </p>
394 <dl>
395
396 <dt><i>assoc</i> (AssociationWidget)</dt>
397 <dd>
398 association to be removed
399 </dd>
400 </dl>
401 <a NAME="UMLItem.removeAssociations" ID="UMLItem.removeAssociations"></a>
402 <h4>UMLItem.removeAssociations</h4>
403 <b>removeAssociations</b>(<i></i>)
404
405 <p>
406 Public method to remove all associations of this widget.
407 </p>
408 <a NAME="UMLItem.setId" ID="UMLItem.setId"></a>
409 <h4>UMLItem.setId</h4>
410 <b>setId</b>(<i>itemId</i>)
411
412 <p>
413 Public method to assign an ID to the item.
414 </p>
415 <dl>
416
417 <dt><i>itemId</i> (int)</dt>
418 <dd>
419 assigned ID
420 </dd>
421 </dl>
422 <a NAME="UMLItem.setPos" ID="UMLItem.setPos"></a>
423 <h4>UMLItem.setPos</h4>
424 <b>setPos</b>(<i>x, y</i>)
425
426 <p>
427 Public overriden method to set the items position.
428 </p>
429 <dl>
430
431 <dt><i>x</i> (float)</dt>
432 <dd>
433 absolute x-position
434 </dd>
435 <dt><i>y</i> (float)</dt>
436 <dd>
437 absolute y-position
438 </dd>
439 </dl>
440 <a NAME="UMLItem.setSize" ID="UMLItem.setSize"></a>
441 <h4>UMLItem.setSize</h4>
442 <b>setSize</b>(<i>width, height</i>)
443
444 <p>
445 Public method to set the rectangles size.
446 </p>
447 <dl>
448
449 <dt><i>width</i> (float)</dt>
450 <dd>
451 width of the rectangle
452 </dd>
453 <dt><i>height</i> (float)</dt>
454 <dd>
455 height of the rectangle
456 </dd>
457 </dl>
458 <a NAME="UMLItem.toDict" ID="UMLItem.toDict"></a>
459 <h4>UMLItem.toDict</h4>
460 <b>toDict</b>(<i></i>)
461
462 <p>
463 Public method to collect data to be persisted.
464 </p>
465 <dl>
466 <dt>Return:</dt>
467 <dd>
468 dictionary containing data to be persisted
469 </dd>
470 </dl>
471 <dl>
472 <dt>Return Type:</dt>
473 <dd>
474 dict
475 </dd>
476 </dl>
477 <div align="right"><a href="#top">Up</a></div>
478 <hr />
479 <hr />
480 <a NAME="UMLModel" ID="UMLModel"></a>
481 <h2>UMLModel</h2>
482
483 <p>
484 Class implementing the UMLModel base class.
485 </p>
486 <h3>Derived from</h3>
487 None
488 <h3>Class Attributes</h3>
489
490 <table>
491 <tr><td>None</td></tr>
492 </table>
493 <h3>Class Methods</h3>
494
495 <table>
496 <tr><td>None</td></tr>
497 </table>
498 <h3>Methods</h3>
499
500 <table>
501
502 <tr>
503 <td><a href="#UMLModel.__init__">UMLModel</a></td>
504 <td>Constructor</td>
505 </tr>
506 <tr>
507 <td><a href="#UMLModel.getName">getName</a></td>
508 <td>Public method to retrieve the model name.</td>
509 </tr>
510 </table>
511 <h3>Static Methods</h3>
512
513 <table>
514 <tr><td>None</td></tr>
515 </table>
516
517 <a NAME="UMLModel.__init__" ID="UMLModel.__init__"></a>
518 <h4>UMLModel (Constructor)</h4>
519 <b>UMLModel</b>(<i>name</i>)
520
521 <p>
522 Constructor
523 </p>
524 <dl>
525
526 <dt><i>name</i> (str)</dt>
527 <dd>
528 package name
529 </dd>
530 </dl>
531 <a NAME="UMLModel.getName" ID="UMLModel.getName"></a>
532 <h4>UMLModel.getName</h4>
533 <b>getName</b>(<i></i>)
534
535 <p>
536 Public method to retrieve the model name.
537 </p>
538 <dl>
539 <dt>Return:</dt>
540 <dd>
541 model name
542 </dd>
543 </dl>
544 <dl>
545 <dt>Return Type:</dt>
546 <dd>
547 str
548 </dd>
549 </dl>
550 <div align="right"><a href="#top">Up</a></div>
551 <hr />
552 </body></html>

eric ide

mercurial