Documentation/Source/eric4.E4Graphics.E4GraphicsView.html

changeset 3
0d9daebf5b8c
equal deleted inserted replaced
2:bc6196164237 3:0d9daebf5b8c
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
4 <html><head>
5 <title>eric4.E4Graphics.E4GraphicsView</title>
6 <style>
7 body {
8 background:white;
9 margin: 0em 1em 10em 1em;
10 color: black;
11 }
12
13 h1 { color: white; background: #4FA4FF; }
14 h2 { color: white; background: #4FA4FF; }
15 h3 { color: white; background: #00557F; }
16 h4 { color: white; background: #00557F; }
17
18 a { color: #AA5500; }
19
20 </style>
21 </head>
22 <body><a NAME="top" ID="top"></a>
23 <h1>eric4.E4Graphics.E4GraphicsView</h1>
24 <p>
25 Module implementing a canvas view class.
26 </p>
27 <h3>Global Attributes</h3>
28 <table>
29 <tr><td>None</td></tr>
30 </table>
31 <h3>Classes</h3>
32 <table>
33 <tr>
34 <td><a href="#E4GraphicsView">E4GraphicsView</a></td>
35 <td>Class implementing a graphics view.</td>
36 </tr>
37 </table>
38 <h3>Functions</h3>
39 <table>
40 <tr><td>None</td></tr>
41 </table>
42 <hr /><hr />
43 <a NAME="E4GraphicsView" ID="E4GraphicsView"></a>
44 <h2>E4GraphicsView</h2>
45 <p>
46 Class implementing a graphics view.
47 </p>
48 <h3>Derived from</h3>
49 QGraphicsView
50 <h3>Class Attributes</h3>
51 <table>
52 <tr><td>None</td></tr>
53 </table>
54 <h3>Methods</h3>
55 <table>
56 <tr>
57 <td><a href="#E4GraphicsView.__init__">E4GraphicsView</a></td>
58 <td>Constructor</td>
59 </tr><tr>
60 <td><a href="#E4GraphicsView.__getDiagram">__getDiagram</a></td>
61 <td>Private method to retrieve the diagram from the scene fitting it in the minimum rectangle.</td>
62 </tr><tr>
63 <td><a href="#E4GraphicsView._getDiagramRect">_getDiagramRect</a></td>
64 <td>Protected method to calculate the minimum rectangle fitting the diagram.</td>
65 </tr><tr>
66 <td><a href="#E4GraphicsView._getDiagramSize">_getDiagramSize</a></td>
67 <td>Protected method to calculate the minimum size fitting the diagram.</td>
68 </tr><tr>
69 <td><a href="#E4GraphicsView.filteredItems">filteredItems</a></td>
70 <td>Public method to filter a list of items.</td>
71 </tr><tr>
72 <td><a href="#E4GraphicsView.printDiagram">printDiagram</a></td>
73 <td>Public method to print the diagram.</td>
74 </tr><tr>
75 <td><a href="#E4GraphicsView.resizeScene">resizeScene</a></td>
76 <td>Public method to resize the scene.</td>
77 </tr><tr>
78 <td><a href="#E4GraphicsView.saveImage">saveImage</a></td>
79 <td>Public method to save the scene to a file.</td>
80 </tr><tr>
81 <td><a href="#E4GraphicsView.setSceneSize">setSceneSize</a></td>
82 <td>Public method to set the scene size.</td>
83 </tr><tr>
84 <td><a href="#E4GraphicsView.setZoom">setZoom</a></td>
85 <td>Public method to set the zoom factor.</td>
86 </tr><tr>
87 <td><a href="#E4GraphicsView.zoom">zoom</a></td>
88 <td>Public method to get the current zoom factor.</td>
89 </tr><tr>
90 <td><a href="#E4GraphicsView.zoomIn">zoomIn</a></td>
91 <td>Public method to zoom in.</td>
92 </tr><tr>
93 <td><a href="#E4GraphicsView.zoomOut">zoomOut</a></td>
94 <td>Public method to zoom out.</td>
95 </tr><tr>
96 <td><a href="#E4GraphicsView.zoomReset">zoomReset</a></td>
97 <td>Public method to handle the reset zoom context menu entry.</td>
98 </tr>
99 </table>
100 <a NAME="E4GraphicsView.__init__" ID="E4GraphicsView.__init__"></a>
101 <h4>E4GraphicsView (Constructor)</h4>
102 <b>E4GraphicsView</b>(<i>scene, parent = None</i>)
103 <p>
104 Constructor
105 </p><dl>
106 <dt><i>scene</i></dt>
107 <dd>
108 reference to the scene object (QGraphicsScene)
109 </dd><dt><i>parent</i></dt>
110 <dd>
111 parent widget (QWidget)
112 </dd>
113 </dl><a NAME="E4GraphicsView.__getDiagram" ID="E4GraphicsView.__getDiagram"></a>
114 <h4>E4GraphicsView.__getDiagram</h4>
115 <b>__getDiagram</b>(<i>rect, format = "PNG", filename = None</i>)
116 <p>
117 Private method to retrieve the diagram from the scene fitting it
118 in the minimum rectangle.
119 </p><dl>
120 <dt><i>rect</i></dt>
121 <dd>
122 minimum rectangle fitting the diagram (QRectF)
123 </dd><dt><i>format</i></dt>
124 <dd>
125 format for the image file (string)
126 </dd><dt><i>filename</i></dt>
127 <dd>
128 name of the file for non pixmaps (string)
129 </dd>
130 </dl><dl>
131 <dt>Returns:</dt>
132 <dd>
133 diagram pixmap to receive the diagram (QPixmap)
134 </dd>
135 </dl><a NAME="E4GraphicsView._getDiagramRect" ID="E4GraphicsView._getDiagramRect"></a>
136 <h4>E4GraphicsView._getDiagramRect</h4>
137 <b>_getDiagramRect</b>(<i>border = 0</i>)
138 <p>
139 Protected method to calculate the minimum rectangle fitting the diagram.
140 </p><dl>
141 <dt><i>border</i></dt>
142 <dd>
143 border width to include in the calculation (integer)
144 </dd>
145 </dl><dl>
146 <dt>Returns:</dt>
147 <dd>
148 the minimum rectangle (QRectF)
149 </dd>
150 </dl><a NAME="E4GraphicsView._getDiagramSize" ID="E4GraphicsView._getDiagramSize"></a>
151 <h4>E4GraphicsView._getDiagramSize</h4>
152 <b>_getDiagramSize</b>(<i>border = 0</i>)
153 <p>
154 Protected method to calculate the minimum size fitting the diagram.
155 </p><dl>
156 <dt><i>border</i></dt>
157 <dd>
158 border width to include in the calculation (integer)
159 </dd>
160 </dl><dl>
161 <dt>Returns:</dt>
162 <dd>
163 the minimum size (QSizeF)
164 </dd>
165 </dl><a NAME="E4GraphicsView.filteredItems" ID="E4GraphicsView.filteredItems"></a>
166 <h4>E4GraphicsView.filteredItems</h4>
167 <b>filteredItems</b>(<i>items</i>)
168 <p>
169 Public method to filter a list of items.
170 </p><dl>
171 <dt><i>items</i></dt>
172 <dd>
173 list of items as returned by the scene object
174 (QGraphicsItem)
175 </dd>
176 </dl><dl>
177 <dt>Returns:</dt>
178 <dd>
179 list of interesting collision items (QGraphicsItem)
180 </dd>
181 </dl><a NAME="E4GraphicsView.printDiagram" ID="E4GraphicsView.printDiagram"></a>
182 <h4>E4GraphicsView.printDiagram</h4>
183 <b>printDiagram</b>(<i>printer, diagramName = ""</i>)
184 <p>
185 Public method to print the diagram.
186 </p><dl>
187 <dt><i>printer</i></dt>
188 <dd>
189 reference to a ready configured printer object (QPrinter)
190 </dd><dt><i>diagramName</i></dt>
191 <dd>
192 name of the diagram (string)
193 </dd>
194 </dl><a NAME="E4GraphicsView.resizeScene" ID="E4GraphicsView.resizeScene"></a>
195 <h4>E4GraphicsView.resizeScene</h4>
196 <b>resizeScene</b>(<i>amount, isWidth = True</i>)
197 <p>
198 Public method to resize the scene.
199 </p><dl>
200 <dt><i>isWidth</i></dt>
201 <dd>
202 flag indicating width is to be resized (boolean)
203 </dd><dt><i>amount</i></dt>
204 <dd>
205 size increment (integer)
206 </dd>
207 </dl><a NAME="E4GraphicsView.saveImage" ID="E4GraphicsView.saveImage"></a>
208 <h4>E4GraphicsView.saveImage</h4>
209 <b>saveImage</b>(<i>filename, format = "PNG"</i>)
210 <p>
211 Public method to save the scene to a file.
212 </p><dl>
213 <dt><i>filename</i></dt>
214 <dd>
215 name of the file to write the image to (string)
216 </dd><dt><i>format</i></dt>
217 <dd>
218 format for the image file (string)
219 </dd>
220 </dl><dl>
221 <dt>Returns:</dt>
222 <dd>
223 flag indicating success (boolean)
224 </dd>
225 </dl><a NAME="E4GraphicsView.setSceneSize" ID="E4GraphicsView.setSceneSize"></a>
226 <h4>E4GraphicsView.setSceneSize</h4>
227 <b>setSceneSize</b>(<i>width, height</i>)
228 <p>
229 Public method to set the scene size.
230 </p><dl>
231 <dt><i>width</i></dt>
232 <dd>
233 width for the scene (integer)
234 </dd><dt><i>height</i></dt>
235 <dd>
236 height for the scene (integer)
237 </dd>
238 </dl><a NAME="E4GraphicsView.setZoom" ID="E4GraphicsView.setZoom"></a>
239 <h4>E4GraphicsView.setZoom</h4>
240 <b>setZoom</b>(<i>zoomFactor</i>)
241 <p>
242 Public method to set the zoom factor.
243 </p><dl>
244 <dt><i>zoomFactor</i></dt>
245 <dd>
246 new zoom factor (float)
247 </dd>
248 </dl><a NAME="E4GraphicsView.zoom" ID="E4GraphicsView.zoom"></a>
249 <h4>E4GraphicsView.zoom</h4>
250 <b>zoom</b>(<i></i>)
251 <p>
252 Public method to get the current zoom factor.
253 </p><dl>
254 <dt>Returns:</dt>
255 <dd>
256 current zoom factor (float)
257 </dd>
258 </dl><a NAME="E4GraphicsView.zoomIn" ID="E4GraphicsView.zoomIn"></a>
259 <h4>E4GraphicsView.zoomIn</h4>
260 <b>zoomIn</b>(<i></i>)
261 <p>
262 Public method to zoom in.
263 </p><a NAME="E4GraphicsView.zoomOut" ID="E4GraphicsView.zoomOut"></a>
264 <h4>E4GraphicsView.zoomOut</h4>
265 <b>zoomOut</b>(<i></i>)
266 <p>
267 Public method to zoom out.
268 </p><a NAME="E4GraphicsView.zoomReset" ID="E4GraphicsView.zoomReset"></a>
269 <h4>E4GraphicsView.zoomReset</h4>
270 <b>zoomReset</b>(<i></i>)
271 <p>
272 Public method to handle the reset zoom context menu entry.
273 </p>
274 <div align="right"><a href="#top">Up</a></div>
275 <hr />
276 </body></html>

eric ide

mercurial