Documentation/Source/eric5.Graphics.UMLGraphicsView.html

Sun, 09 Sep 2012 17:40:32 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 09 Sep 2012 17:40:32 +0200
changeset 2031
c36c2eb62a75
parent 2027
144463496a54
child 2033
4b99609f6a87
permissions
-rw-r--r--

Refactored the UML graphics code.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html><head>
<title>eric5.Graphics.UMLGraphicsView</title>
<style>
body {
    background: #EDECE6;
    margin: 0em 1em 10em 1em;
    color: black;
}

h1 { color: white; background: #85774A; }
h2 { color: white; background: #85774A; }
h3 { color: white; background: #9D936E; }
h4 { color: white; background: #9D936E; }
    
a { color: #BA6D36; }

</style>
</head>
<body><a NAME="top" ID="top"></a>
<h1>eric5.Graphics.UMLGraphicsView</h1>
<p>
Module implementing a subclass of E5GraphicsView for our diagrams.
</p>
<h3>Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Classes</h3>
<table>
<tr>
<td><a href="#UMLGraphicsView">UMLGraphicsView</a></td>
<td>Class implementing a specialized E5GraphicsView for our diagrams.</td>
</tr>
</table>
<h3>Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="UMLGraphicsView" ID="UMLGraphicsView"></a>
<h2>UMLGraphicsView</h2>
<p>
    Class implementing a specialized E5GraphicsView for our diagrams.
</p><h3>Signals</h3>
<dl>
<dt>relayout()</dt>
<dd>
emitted to indicate a relayout of the diagram
        is requested
</dd>
</dl>
<h3>Derived from</h3>
E5GraphicsView
<h3>Class Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Class Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>
<table>
<tr>
<td><a href="#UMLGraphicsView.__init__">UMLGraphicsView</a></td>
<td>Constructor</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__alignShapes">__alignShapes</a></td>
<td>Private slot to align the selected shapes.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__checkSizeActions">__checkSizeActions</a></td>
<td>Private slot to set the enabled state of the size actions.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__decHeight">__decHeight</a></td>
<td>Private method to handle the decrease height context menu entry.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__decWidth">__decWidth</a></td>
<td>Private method to handle the decrease width context menu entry.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__deleteShape">__deleteShape</a></td>
<td>Private method to delete the selected shapes from the display.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__incHeight">__incHeight</a></td>
<td>Private method to handle the increase height context menu entry.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__incWidth">__incWidth</a></td>
<td>Private method to handle the increase width context menu entry.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__initActions">__initActions</a></td>
<td>Private method to initialize the view actions.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__printDiagram">__printDiagram</a></td>
<td>Private slot called to print the diagram.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__printPreviewDiagram">__printPreviewDiagram</a></td>
<td>Private slot called to show a print preview of the diagram.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__relayout">__relayout</a></td>
<td>Private method to handle the re-layout context menu entry.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__save">__save</a></td>
<td>Private slot to save the diagram with the current name.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__saveAs">__saveAs</a></td>
<td>Private slot to save the diagram.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__saveImage">__saveImage</a></td>
<td>Private method to handle the save context menu entry.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__sceneChanged">__sceneChanged</a></td>
<td>Private slot called when the scene changes.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__setSize">__setSize</a></td>
<td>Private method to handle the set size context menu entry.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.__zoom">__zoom</a></td>
<td>Private method to handle the zoom context menu action.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.autoAdjustSceneSize">autoAdjustSceneSize</a></td>
<td>Public method to adjust the scene size to the diagram size.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.event">event</a></td>
<td>Protected method handling events.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.filteredItems">filteredItems</a></td>
<td>Public method to filter a list of items.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.findItem">findItem</a></td>
<td>Public method to find an UML item based on the ID.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.gestureEvent">gestureEvent</a></td>
<td>Protected method handling gesture events.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.getItemId">getItemId</a></td>
<td>Public method to get the ID to be assigned to an item.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.getPersistenceData">getPersistenceData</a></td>
<td>Public method to get the additional persistence data.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.initToolBar">initToolBar</a></td>
<td>Public method to populate a toolbar with our actions.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.selectItem">selectItem</a></td>
<td>Public method to select an item.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.selectItems">selectItems</a></td>
<td>Public method to select the given items.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.setDiagramName">setDiagramName</a></td>
<td>Public slot to set the diagram name.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.setPersistenceData">setPersistenceData</a></td>
<td>Public method to set additional persistence data.</td>
</tr><tr>
<td><a href="#UMLGraphicsView.wheelEvent">wheelEvent</a></td>
<td>Protected method to handle wheel events.</td>
</tr>
</table>
<h3>Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="UMLGraphicsView.__init__" ID="UMLGraphicsView.__init__"></a>
<h4>UMLGraphicsView (Constructor)</h4>
<b>UMLGraphicsView</b>(<i>scene, diagramType, parent=None</i>)
<p>
        Constructor
</p><dl>
<dt><i>scene</i></dt>
<dd>
reference to the scene object (QGraphicsScene)
</dd><dt><i>diagramType</i></dt>
<dd>
type of the diagram (string)
</dd><dt><i>parent</i></dt>
<dd>
parent widget of the view (QWidget)
</dd>
</dl><a NAME="UMLGraphicsView.__alignShapes" ID="UMLGraphicsView.__alignShapes"></a>
<h4>UMLGraphicsView.__alignShapes</h4>
<b>__alignShapes</b>(<i>alignment</i>)
<p>
        Private slot to align the selected shapes.
</p><dl>
<dt><i>alignment</i></dt>
<dd>
alignment type (Qt.AlignmentFlag)
</dd>
</dl><a NAME="UMLGraphicsView.__checkSizeActions" ID="UMLGraphicsView.__checkSizeActions"></a>
<h4>UMLGraphicsView.__checkSizeActions</h4>
<b>__checkSizeActions</b>(<i></i>)
<p>
        Private slot to set the enabled state of the size actions.
</p><a NAME="UMLGraphicsView.__decHeight" ID="UMLGraphicsView.__decHeight"></a>
<h4>UMLGraphicsView.__decHeight</h4>
<b>__decHeight</b>(<i></i>)
<p>
        Private method to handle the decrease height context menu entry.
</p><a NAME="UMLGraphicsView.__decWidth" ID="UMLGraphicsView.__decWidth"></a>
<h4>UMLGraphicsView.__decWidth</h4>
<b>__decWidth</b>(<i></i>)
<p>
        Private method to handle the decrease width context menu entry.
</p><a NAME="UMLGraphicsView.__deleteShape" ID="UMLGraphicsView.__deleteShape"></a>
<h4>UMLGraphicsView.__deleteShape</h4>
<b>__deleteShape</b>(<i></i>)
<p>
        Private method to delete the selected shapes from the display.
</p><a NAME="UMLGraphicsView.__incHeight" ID="UMLGraphicsView.__incHeight"></a>
<h4>UMLGraphicsView.__incHeight</h4>
<b>__incHeight</b>(<i></i>)
<p>
        Private method to handle the increase height context menu entry.
</p><a NAME="UMLGraphicsView.__incWidth" ID="UMLGraphicsView.__incWidth"></a>
<h4>UMLGraphicsView.__incWidth</h4>
<b>__incWidth</b>(<i></i>)
<p>
        Private method to handle the increase width context menu entry.
</p><a NAME="UMLGraphicsView.__initActions" ID="UMLGraphicsView.__initActions"></a>
<h4>UMLGraphicsView.__initActions</h4>
<b>__initActions</b>(<i></i>)
<p>
        Private method to initialize the view actions.
</p><a NAME="UMLGraphicsView.__printDiagram" ID="UMLGraphicsView.__printDiagram"></a>
<h4>UMLGraphicsView.__printDiagram</h4>
<b>__printDiagram</b>(<i></i>)
<p>
        Private slot called to print the diagram.
</p><a NAME="UMLGraphicsView.__printPreviewDiagram" ID="UMLGraphicsView.__printPreviewDiagram"></a>
<h4>UMLGraphicsView.__printPreviewDiagram</h4>
<b>__printPreviewDiagram</b>(<i></i>)
<p>
        Private slot called to show a print preview of the diagram.
</p><a NAME="UMLGraphicsView.__relayout" ID="UMLGraphicsView.__relayout"></a>
<h4>UMLGraphicsView.__relayout</h4>
<b>__relayout</b>(<i></i>)
<p>
        Private method to handle the re-layout context menu entry.
</p><a NAME="UMLGraphicsView.__save" ID="UMLGraphicsView.__save"></a>
<h4>UMLGraphicsView.__save</h4>
<b>__save</b>(<i></i>)
<p>
        Private slot to save the diagram with the current name.
</p><a NAME="UMLGraphicsView.__saveAs" ID="UMLGraphicsView.__saveAs"></a>
<h4>UMLGraphicsView.__saveAs</h4>
<b>__saveAs</b>(<i>filename=""</i>)
<p>
        Private slot to save the diagram.
</p><dl>
<dt><i>filename</i></dt>
<dd>
name of the file to write to (string)
</dd>
</dl><a NAME="UMLGraphicsView.__saveImage" ID="UMLGraphicsView.__saveImage"></a>
<h4>UMLGraphicsView.__saveImage</h4>
<b>__saveImage</b>(<i></i>)
<p>
        Private method to handle the save context menu entry.
</p><a NAME="UMLGraphicsView.__sceneChanged" ID="UMLGraphicsView.__sceneChanged"></a>
<h4>UMLGraphicsView.__sceneChanged</h4>
<b>__sceneChanged</b>(<i>areas</i>)
<p>
        Private slot called when the scene changes.
</p><dl>
<dt><i>areas</i></dt>
<dd>
list of rectangles that contain changes (list of QRectF)
</dd>
</dl><a NAME="UMLGraphicsView.__setSize" ID="UMLGraphicsView.__setSize"></a>
<h4>UMLGraphicsView.__setSize</h4>
<b>__setSize</b>(<i></i>)
<p>
        Private method to handle the set size context menu entry.
</p><a NAME="UMLGraphicsView.__zoom" ID="UMLGraphicsView.__zoom"></a>
<h4>UMLGraphicsView.__zoom</h4>
<b>__zoom</b>(<i></i>)
<p>
        Private method to handle the zoom context menu action.
</p><a NAME="UMLGraphicsView.autoAdjustSceneSize" ID="UMLGraphicsView.autoAdjustSceneSize"></a>
<h4>UMLGraphicsView.autoAdjustSceneSize</h4>
<b>autoAdjustSceneSize</b>(<i>limit=False</i>)
<p>
        Public method to adjust the scene size to the diagram size.
</p><dl>
<dt><i>limit</i></dt>
<dd>
flag indicating to limit the scene to the
            initial size (boolean)
</dd>
</dl><a NAME="UMLGraphicsView.event" ID="UMLGraphicsView.event"></a>
<h4>UMLGraphicsView.event</h4>
<b>event</b>(<i>evt</i>)
<p>
        Protected method handling events.
</p><dl>
<dt><i>evt</i></dt>
<dd>
reference to the event (QEvent)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
flag indicating, if the event was handled (boolean)
</dd>
</dl><a NAME="UMLGraphicsView.filteredItems" ID="UMLGraphicsView.filteredItems"></a>
<h4>UMLGraphicsView.filteredItems</h4>
<b>filteredItems</b>(<i>items, itemType=UMLItem</i>)
<p>
        Public method to filter a list of items.
</p><dl>
<dt><i>items</i></dt>
<dd>
list of items as returned by the scene object
            (QGraphicsItem)
</dd><dt><i>itemType</i></dt>
<dd>
type to be filtered (class)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
list of interesting collision items (QGraphicsItem)
</dd>
</dl><a NAME="UMLGraphicsView.findItem" ID="UMLGraphicsView.findItem"></a>
<h4>UMLGraphicsView.findItem</h4>
<b>findItem</b>(<i>id</i>)
<p>
        Public method to find an UML item based on the ID.
</p><dl>
<dt><i>id</i></dt>
<dd>
of the item to search for (integer)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
item found (UMLItem) or None
</dd>
</dl><a NAME="UMLGraphicsView.gestureEvent" ID="UMLGraphicsView.gestureEvent"></a>
<h4>UMLGraphicsView.gestureEvent</h4>
<b>gestureEvent</b>(<i>evt</i>)
<p>
        Protected method handling gesture events.
</p><dl>
<dt><i>evt</i></dt>
<dd>
reference to the gesture event (QGestureEvent
</dd>
</dl><a NAME="UMLGraphicsView.getItemId" ID="UMLGraphicsView.getItemId"></a>
<h4>UMLGraphicsView.getItemId</h4>
<b>getItemId</b>(<i></i>)
<p>
        Public method to get the ID to be assigned to an item.
</p><dl>
<dt>Returns:</dt>
<dd>
item ID (integer)
</dd>
</dl><a NAME="UMLGraphicsView.getPersistenceData" ID="UMLGraphicsView.getPersistenceData"></a>
<h4>UMLGraphicsView.getPersistenceData</h4>
<b>getPersistenceData</b>(<i></i>)
<p>
        Public method to get the additional persistence data.
</p><dl>
<dt>Returns:</dt>
<dd>
additional persistence data (string)
</dd>
</dl><a NAME="UMLGraphicsView.initToolBar" ID="UMLGraphicsView.initToolBar"></a>
<h4>UMLGraphicsView.initToolBar</h4>
<b>initToolBar</b>(<i></i>)
<p>
        Public method to populate a toolbar with our actions.
</p><dl>
<dt>Returns:</dt>
<dd>
the populated toolBar (QToolBar)
</dd>
</dl><a NAME="UMLGraphicsView.selectItem" ID="UMLGraphicsView.selectItem"></a>
<h4>UMLGraphicsView.selectItem</h4>
<b>selectItem</b>(<i>item</i>)
<p>
        Public method to select an item.
</p><dl>
<dt><i>item</i></dt>
<dd>
item to be selected (QGraphicsItemItem)
</dd>
</dl><a NAME="UMLGraphicsView.selectItems" ID="UMLGraphicsView.selectItems"></a>
<h4>UMLGraphicsView.selectItems</h4>
<b>selectItems</b>(<i>items</i>)
<p>
        Public method to select the given items.
</p><dl>
<dt><i>items</i></dt>
<dd>
list of items to be selected (list of QGraphicsItemItem)
</dd>
</dl><a NAME="UMLGraphicsView.setDiagramName" ID="UMLGraphicsView.setDiagramName"></a>
<h4>UMLGraphicsView.setDiagramName</h4>
<b>setDiagramName</b>(<i>name</i>)
<p>
        Public slot to set the diagram name.
</p><dl>
<dt><i>name</i></dt>
<dd>
diagram name (string)
</dd>
</dl><a NAME="UMLGraphicsView.setPersistenceData" ID="UMLGraphicsView.setPersistenceData"></a>
<h4>UMLGraphicsView.setPersistenceData</h4>
<b>setPersistenceData</b>(<i>data</i>)
<p>
        Public method to set additional persistence data.
</p><dl>
<dt><i>data</i></dt>
<dd>
string of additional data to be made persistent (string)
</dd>
</dl><a NAME="UMLGraphicsView.wheelEvent" ID="UMLGraphicsView.wheelEvent"></a>
<h4>UMLGraphicsView.wheelEvent</h4>
<b>wheelEvent</b>(<i>evt</i>)
<p>
        Protected method to handle wheel events.
</p><dl>
<dt><i>evt</i></dt>
<dd>
reference to the wheel event (QWheelEvent)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial