eric6/Documentation/Source/eric6.Graphics.UMLGraphicsView.html

changeset 6942
2602857055c5
parent 5606
da305d172769
child 7273
391d6b7b1eff
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.Graphics.UMLGraphicsView</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.UMLGraphicsView</h1>
23 <p>
24 Module implementing a subclass of E5GraphicsView for our diagrams.
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="#UMLGraphicsView">UMLGraphicsView</a></td>
34 <td>Class implementing a specialized E5GraphicsView for our diagrams.</td>
35 </tr>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr><td>None</td></tr>
40 </table>
41 <hr /><hr />
42 <a NAME="UMLGraphicsView" ID="UMLGraphicsView"></a>
43 <h2>UMLGraphicsView</h2>
44 <p>
45 Class implementing a specialized E5GraphicsView for our diagrams.
46 </p><h3>Signals</h3>
47 <dl>
48 <dt>relayout()</dt>
49 <dd>
50 emitted to indicate a relayout of the diagram
51 is requested
52 </dd>
53 </dl>
54 <h3>Derived from</h3>
55 E5GraphicsView
56 <h3>Class Attributes</h3>
57 <table>
58 <tr><td>None</td></tr>
59 </table>
60 <h3>Class Methods</h3>
61 <table>
62 <tr><td>None</td></tr>
63 </table>
64 <h3>Methods</h3>
65 <table>
66 <tr>
67 <td><a href="#UMLGraphicsView.__init__">UMLGraphicsView</a></td>
68 <td>Constructor</td>
69 </tr><tr>
70 <td><a href="#UMLGraphicsView.__alignShapes">__alignShapes</a></td>
71 <td>Private slot to align the selected shapes.</td>
72 </tr><tr>
73 <td><a href="#UMLGraphicsView.__checkSizeActions">__checkSizeActions</a></td>
74 <td>Private slot to set the enabled state of the size actions.</td>
75 </tr><tr>
76 <td><a href="#UMLGraphicsView.__decHeight">__decHeight</a></td>
77 <td>Private method to handle the decrease height context menu entry.</td>
78 </tr><tr>
79 <td><a href="#UMLGraphicsView.__decWidth">__decWidth</a></td>
80 <td>Private method to handle the decrease width context menu entry.</td>
81 </tr><tr>
82 <td><a href="#UMLGraphicsView.__deleteShape">__deleteShape</a></td>
83 <td>Private method to delete the selected shapes from the display.</td>
84 </tr><tr>
85 <td><a href="#UMLGraphicsView.__incHeight">__incHeight</a></td>
86 <td>Private method to handle the increase height context menu entry.</td>
87 </tr><tr>
88 <td><a href="#UMLGraphicsView.__incWidth">__incWidth</a></td>
89 <td>Private method to handle the increase width context menu entry.</td>
90 </tr><tr>
91 <td><a href="#UMLGraphicsView.__initActions">__initActions</a></td>
92 <td>Private method to initialize the view actions.</td>
93 </tr><tr>
94 <td><a href="#UMLGraphicsView.__itemsBoundingRect">__itemsBoundingRect</a></td>
95 <td>Private method to calculate the bounding rectangle of the given items.</td>
96 </tr><tr>
97 <td><a href="#UMLGraphicsView.__printPreviewPrint">__printPreviewPrint</a></td>
98 <td>Private slot to generate a print preview.</td>
99 </tr><tr>
100 <td><a href="#UMLGraphicsView.__relayout">__relayout</a></td>
101 <td>Private slot to handle the re-layout context menu entry.</td>
102 </tr><tr>
103 <td><a href="#UMLGraphicsView.__rescan">__rescan</a></td>
104 <td>Private slot to handle the re-scan context menu entry.</td>
105 </tr><tr>
106 <td><a href="#UMLGraphicsView.__sceneChanged">__sceneChanged</a></td>
107 <td>Private slot called when the scene changes.</td>
108 </tr><tr>
109 <td><a href="#UMLGraphicsView.__setSize">__setSize</a></td>
110 <td>Private method to handle the set size context menu entry.</td>
111 </tr><tr>
112 <td><a href="#UMLGraphicsView.autoAdjustSceneSize">autoAdjustSceneSize</a></td>
113 <td>Public method to adjust the scene size to the diagram size.</td>
114 </tr><tr>
115 <td><a href="#UMLGraphicsView.event">event</a></td>
116 <td>Public method handling events.</td>
117 </tr><tr>
118 <td><a href="#UMLGraphicsView.filteredItems">filteredItems</a></td>
119 <td>Public method to filter a list of items.</td>
120 </tr><tr>
121 <td><a href="#UMLGraphicsView.findItem">findItem</a></td>
122 <td>Public method to find an UML item based on the ID.</td>
123 </tr><tr>
124 <td><a href="#UMLGraphicsView.findItemByName">findItemByName</a></td>
125 <td>Public method to find an UML item based on its name.</td>
126 </tr><tr>
127 <td><a href="#UMLGraphicsView.gestureEvent">gestureEvent</a></td>
128 <td>Protected method handling gesture events.</td>
129 </tr><tr>
130 <td><a href="#UMLGraphicsView.getItemId">getItemId</a></td>
131 <td>Public method to get the ID to be assigned to an item.</td>
132 </tr><tr>
133 <td><a href="#UMLGraphicsView.getPersistenceData">getPersistenceData</a></td>
134 <td>Public method to get a list of data to be persisted.</td>
135 </tr><tr>
136 <td><a href="#UMLGraphicsView.initToolBar">initToolBar</a></td>
137 <td>Public method to populate a toolbar with our actions.</td>
138 </tr><tr>
139 <td><a href="#UMLGraphicsView.keyPressEvent">keyPressEvent</a></td>
140 <td>Protected method handling key press events.</td>
141 </tr><tr>
142 <td><a href="#UMLGraphicsView.parsePersistenceData">parsePersistenceData</a></td>
143 <td>Public method to parse persisted data.</td>
144 </tr><tr>
145 <td><a href="#UMLGraphicsView.printDiagram">printDiagram</a></td>
146 <td>Public slot called to print the diagram.</td>
147 </tr><tr>
148 <td><a href="#UMLGraphicsView.printPreviewDiagram">printPreviewDiagram</a></td>
149 <td>Public slot called to show a print preview of the diagram.</td>
150 </tr><tr>
151 <td><a href="#UMLGraphicsView.saveImage">saveImage</a></td>
152 <td>Public method to handle the save context menu entry.</td>
153 </tr><tr>
154 <td><a href="#UMLGraphicsView.selectItem">selectItem</a></td>
155 <td>Public method to select an item.</td>
156 </tr><tr>
157 <td><a href="#UMLGraphicsView.selectItems">selectItems</a></td>
158 <td>Public method to select the given items.</td>
159 </tr><tr>
160 <td><a href="#UMLGraphicsView.setDiagramName">setDiagramName</a></td>
161 <td>Public slot to set the diagram name.</td>
162 </tr><tr>
163 <td><a href="#UMLGraphicsView.wheelEvent">wheelEvent</a></td>
164 <td>Protected method to handle wheel events.</td>
165 </tr>
166 </table>
167 <h3>Static Methods</h3>
168 <table>
169 <tr><td>None</td></tr>
170 </table>
171 <a NAME="UMLGraphicsView.__init__" ID="UMLGraphicsView.__init__"></a>
172 <h4>UMLGraphicsView (Constructor)</h4>
173 <b>UMLGraphicsView</b>(<i>scene, parent=None</i>)
174 <p>
175 Constructor
176 </p><dl>
177 <dt><i>scene</i></dt>
178 <dd>
179 reference to the scene object (QGraphicsScene)
180 </dd><dt><i>parent</i></dt>
181 <dd>
182 parent widget of the view (QWidget)
183 </dd>
184 </dl><a NAME="UMLGraphicsView.__alignShapes" ID="UMLGraphicsView.__alignShapes"></a>
185 <h4>UMLGraphicsView.__alignShapes</h4>
186 <b>__alignShapes</b>(<i>alignment</i>)
187 <p>
188 Private slot to align the selected shapes.
189 </p><dl>
190 <dt><i>alignment</i></dt>
191 <dd>
192 alignment type (Qt.AlignmentFlag)
193 </dd>
194 </dl><a NAME="UMLGraphicsView.__checkSizeActions" ID="UMLGraphicsView.__checkSizeActions"></a>
195 <h4>UMLGraphicsView.__checkSizeActions</h4>
196 <b>__checkSizeActions</b>(<i></i>)
197 <p>
198 Private slot to set the enabled state of the size actions.
199 </p><a NAME="UMLGraphicsView.__decHeight" ID="UMLGraphicsView.__decHeight"></a>
200 <h4>UMLGraphicsView.__decHeight</h4>
201 <b>__decHeight</b>(<i></i>)
202 <p>
203 Private method to handle the decrease height context menu entry.
204 </p><a NAME="UMLGraphicsView.__decWidth" ID="UMLGraphicsView.__decWidth"></a>
205 <h4>UMLGraphicsView.__decWidth</h4>
206 <b>__decWidth</b>(<i></i>)
207 <p>
208 Private method to handle the decrease width context menu entry.
209 </p><a NAME="UMLGraphicsView.__deleteShape" ID="UMLGraphicsView.__deleteShape"></a>
210 <h4>UMLGraphicsView.__deleteShape</h4>
211 <b>__deleteShape</b>(<i></i>)
212 <p>
213 Private method to delete the selected shapes from the display.
214 </p><a NAME="UMLGraphicsView.__incHeight" ID="UMLGraphicsView.__incHeight"></a>
215 <h4>UMLGraphicsView.__incHeight</h4>
216 <b>__incHeight</b>(<i></i>)
217 <p>
218 Private method to handle the increase height context menu entry.
219 </p><a NAME="UMLGraphicsView.__incWidth" ID="UMLGraphicsView.__incWidth"></a>
220 <h4>UMLGraphicsView.__incWidth</h4>
221 <b>__incWidth</b>(<i></i>)
222 <p>
223 Private method to handle the increase width context menu entry.
224 </p><a NAME="UMLGraphicsView.__initActions" ID="UMLGraphicsView.__initActions"></a>
225 <h4>UMLGraphicsView.__initActions</h4>
226 <b>__initActions</b>(<i></i>)
227 <p>
228 Private method to initialize the view actions.
229 </p><a NAME="UMLGraphicsView.__itemsBoundingRect" ID="UMLGraphicsView.__itemsBoundingRect"></a>
230 <h4>UMLGraphicsView.__itemsBoundingRect</h4>
231 <b>__itemsBoundingRect</b>(<i>items</i>)
232 <p>
233 Private method to calculate the bounding rectangle of the given items.
234 </p><dl>
235 <dt><i>items</i></dt>
236 <dd>
237 list of items to operate on (list of UMLItem)
238 </dd>
239 </dl><dl>
240 <dt>Returns:</dt>
241 <dd>
242 bounding rectangle (QRectF)
243 </dd>
244 </dl><a NAME="UMLGraphicsView.__printPreviewPrint" ID="UMLGraphicsView.__printPreviewPrint"></a>
245 <h4>UMLGraphicsView.__printPreviewPrint</h4>
246 <b>__printPreviewPrint</b>(<i>printer</i>)
247 <p>
248 Private slot to generate a print preview.
249 </p><dl>
250 <dt><i>printer</i></dt>
251 <dd>
252 reference to the printer object (QPrinter)
253 </dd>
254 </dl><a NAME="UMLGraphicsView.__relayout" ID="UMLGraphicsView.__relayout"></a>
255 <h4>UMLGraphicsView.__relayout</h4>
256 <b>__relayout</b>(<i></i>)
257 <p>
258 Private slot to handle the re-layout context menu entry.
259 </p><a NAME="UMLGraphicsView.__rescan" ID="UMLGraphicsView.__rescan"></a>
260 <h4>UMLGraphicsView.__rescan</h4>
261 <b>__rescan</b>(<i></i>)
262 <p>
263 Private slot to handle the re-scan context menu entry.
264 </p><a NAME="UMLGraphicsView.__sceneChanged" ID="UMLGraphicsView.__sceneChanged"></a>
265 <h4>UMLGraphicsView.__sceneChanged</h4>
266 <b>__sceneChanged</b>(<i>areas</i>)
267 <p>
268 Private slot called when the scene changes.
269 </p><dl>
270 <dt><i>areas</i></dt>
271 <dd>
272 list of rectangles that contain changes (list of QRectF)
273 </dd>
274 </dl><a NAME="UMLGraphicsView.__setSize" ID="UMLGraphicsView.__setSize"></a>
275 <h4>UMLGraphicsView.__setSize</h4>
276 <b>__setSize</b>(<i></i>)
277 <p>
278 Private method to handle the set size context menu entry.
279 </p><a NAME="UMLGraphicsView.autoAdjustSceneSize" ID="UMLGraphicsView.autoAdjustSceneSize"></a>
280 <h4>UMLGraphicsView.autoAdjustSceneSize</h4>
281 <b>autoAdjustSceneSize</b>(<i>limit=False</i>)
282 <p>
283 Public method to adjust the scene size to the diagram size.
284 </p><dl>
285 <dt><i>limit</i></dt>
286 <dd>
287 flag indicating to limit the scene to the
288 initial size (boolean)
289 </dd>
290 </dl><a NAME="UMLGraphicsView.event" ID="UMLGraphicsView.event"></a>
291 <h4>UMLGraphicsView.event</h4>
292 <b>event</b>(<i>evt</i>)
293 <p>
294 Public method handling events.
295 </p><dl>
296 <dt><i>evt</i></dt>
297 <dd>
298 reference to the event (QEvent)
299 </dd>
300 </dl><dl>
301 <dt>Returns:</dt>
302 <dd>
303 flag indicating, if the event was handled (boolean)
304 </dd>
305 </dl><a NAME="UMLGraphicsView.filteredItems" ID="UMLGraphicsView.filteredItems"></a>
306 <h4>UMLGraphicsView.filteredItems</h4>
307 <b>filteredItems</b>(<i>items, itemType=UMLItem</i>)
308 <p>
309 Public method to filter a list of items.
310 </p><dl>
311 <dt><i>items</i></dt>
312 <dd>
313 list of items as returned by the scene object
314 (QGraphicsItem)
315 </dd><dt><i>itemType</i></dt>
316 <dd>
317 type to be filtered (class)
318 </dd>
319 </dl><dl>
320 <dt>Returns:</dt>
321 <dd>
322 list of interesting collision items (QGraphicsItem)
323 </dd>
324 </dl><a NAME="UMLGraphicsView.findItem" ID="UMLGraphicsView.findItem"></a>
325 <h4>UMLGraphicsView.findItem</h4>
326 <b>findItem</b>(<i>itemId</i>)
327 <p>
328 Public method to find an UML item based on the ID.
329 </p><dl>
330 <dt><i>itemId</i></dt>
331 <dd>
332 of the item to search for (integer)
333 </dd>
334 </dl><dl>
335 <dt>Returns:</dt>
336 <dd>
337 item found (UMLItem) or None
338 </dd>
339 </dl><a NAME="UMLGraphicsView.findItemByName" ID="UMLGraphicsView.findItemByName"></a>
340 <h4>UMLGraphicsView.findItemByName</h4>
341 <b>findItemByName</b>(<i>name</i>)
342 <p>
343 Public method to find an UML item based on its name.
344 </p><dl>
345 <dt><i>name</i></dt>
346 <dd>
347 name to look for (string)
348 </dd>
349 </dl><dl>
350 <dt>Returns:</dt>
351 <dd>
352 item found (UMLItem) or None
353 </dd>
354 </dl><a NAME="UMLGraphicsView.gestureEvent" ID="UMLGraphicsView.gestureEvent"></a>
355 <h4>UMLGraphicsView.gestureEvent</h4>
356 <b>gestureEvent</b>(<i>evt</i>)
357 <p>
358 Protected method handling gesture events.
359 </p><dl>
360 <dt><i>evt</i></dt>
361 <dd>
362 reference to the gesture event (QGestureEvent
363 </dd>
364 </dl><a NAME="UMLGraphicsView.getItemId" ID="UMLGraphicsView.getItemId"></a>
365 <h4>UMLGraphicsView.getItemId</h4>
366 <b>getItemId</b>(<i></i>)
367 <p>
368 Public method to get the ID to be assigned to an item.
369 </p><dl>
370 <dt>Returns:</dt>
371 <dd>
372 item ID (integer)
373 </dd>
374 </dl><a NAME="UMLGraphicsView.getPersistenceData" ID="UMLGraphicsView.getPersistenceData"></a>
375 <h4>UMLGraphicsView.getPersistenceData</h4>
376 <b>getPersistenceData</b>(<i></i>)
377 <p>
378 Public method to get a list of data to be persisted.
379 </p><dl>
380 <dt>Returns:</dt>
381 <dd>
382 list of data to be persisted (list of strings)
383 </dd>
384 </dl><a NAME="UMLGraphicsView.initToolBar" ID="UMLGraphicsView.initToolBar"></a>
385 <h4>UMLGraphicsView.initToolBar</h4>
386 <b>initToolBar</b>(<i></i>)
387 <p>
388 Public method to populate a toolbar with our actions.
389 </p><dl>
390 <dt>Returns:</dt>
391 <dd>
392 the populated toolBar (QToolBar)
393 </dd>
394 </dl><a NAME="UMLGraphicsView.keyPressEvent" ID="UMLGraphicsView.keyPressEvent"></a>
395 <h4>UMLGraphicsView.keyPressEvent</h4>
396 <b>keyPressEvent</b>(<i>evt</i>)
397 <p>
398 Protected method handling key press events.
399 </p><dl>
400 <dt><i>evt</i></dt>
401 <dd>
402 reference to the key event (QKeyEvent)
403 </dd>
404 </dl><a NAME="UMLGraphicsView.parsePersistenceData" ID="UMLGraphicsView.parsePersistenceData"></a>
405 <h4>UMLGraphicsView.parsePersistenceData</h4>
406 <b>parsePersistenceData</b>(<i>version, data</i>)
407 <p>
408 Public method to parse persisted data.
409 </p><dl>
410 <dt><i>version</i></dt>
411 <dd>
412 version of the data (string)
413 </dd><dt><i>data</i></dt>
414 <dd>
415 persisted data to be parsed (list of string)
416 </dd>
417 </dl><dl>
418 <dt>Returns:</dt>
419 <dd>
420 tuple of flag indicating success (boolean) and faulty line
421 number (integer)
422 </dd>
423 </dl><a NAME="UMLGraphicsView.printDiagram" ID="UMLGraphicsView.printDiagram"></a>
424 <h4>UMLGraphicsView.printDiagram</h4>
425 <b>printDiagram</b>(<i></i>)
426 <p>
427 Public slot called to print the diagram.
428 </p><a NAME="UMLGraphicsView.printPreviewDiagram" ID="UMLGraphicsView.printPreviewDiagram"></a>
429 <h4>UMLGraphicsView.printPreviewDiagram</h4>
430 <b>printPreviewDiagram</b>(<i></i>)
431 <p>
432 Public slot called to show a print preview of the diagram.
433 </p><a NAME="UMLGraphicsView.saveImage" ID="UMLGraphicsView.saveImage"></a>
434 <h4>UMLGraphicsView.saveImage</h4>
435 <b>saveImage</b>(<i></i>)
436 <p>
437 Public method to handle the save context menu entry.
438 </p><a NAME="UMLGraphicsView.selectItem" ID="UMLGraphicsView.selectItem"></a>
439 <h4>UMLGraphicsView.selectItem</h4>
440 <b>selectItem</b>(<i>item</i>)
441 <p>
442 Public method to select an item.
443 </p><dl>
444 <dt><i>item</i></dt>
445 <dd>
446 item to be selected (QGraphicsItemItem)
447 </dd>
448 </dl><a NAME="UMLGraphicsView.selectItems" ID="UMLGraphicsView.selectItems"></a>
449 <h4>UMLGraphicsView.selectItems</h4>
450 <b>selectItems</b>(<i>items</i>)
451 <p>
452 Public method to select the given items.
453 </p><dl>
454 <dt><i>items</i></dt>
455 <dd>
456 list of items to be selected (list of QGraphicsItemItem)
457 </dd>
458 </dl><a NAME="UMLGraphicsView.setDiagramName" ID="UMLGraphicsView.setDiagramName"></a>
459 <h4>UMLGraphicsView.setDiagramName</h4>
460 <b>setDiagramName</b>(<i>name</i>)
461 <p>
462 Public slot to set the diagram name.
463 </p><dl>
464 <dt><i>name</i></dt>
465 <dd>
466 diagram name (string)
467 </dd>
468 </dl><a NAME="UMLGraphicsView.wheelEvent" ID="UMLGraphicsView.wheelEvent"></a>
469 <h4>UMLGraphicsView.wheelEvent</h4>
470 <b>wheelEvent</b>(<i>evt</i>)
471 <p>
472 Protected method to handle wheel events.
473 </p><dl>
474 <dt><i>evt</i></dt>
475 <dd>
476 reference to the wheel event (QWheelEvent)
477 </dd>
478 </dl>
479 <div align="right"><a href="#top">Up</a></div>
480 <hr />
481 </body></html>

eric ide

mercurial