|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.E5Graphics.E5GraphicsView</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.E5Graphics.E5GraphicsView</h1> |
|
23 <p> |
|
24 Module implementing a canvas view class. |
|
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="#E5GraphicsView">E5GraphicsView</a></td> |
|
34 <td>Class implementing a graphics view.</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="E5GraphicsView" ID="E5GraphicsView"></a> |
|
43 <h2>E5GraphicsView</h2> |
|
44 <p> |
|
45 Class implementing a graphics view. |
|
46 </p><h3>Signals</h3> |
|
47 <dl> |
|
48 <dt>zoomValueChanged(int)</dt> |
|
49 <dd> |
|
50 emitted to signal a change of the zoom value |
|
51 </dd> |
|
52 </dl> |
|
53 <h3>Derived from</h3> |
|
54 QGraphicsView |
|
55 <h3>Class Attributes</h3> |
|
56 <table> |
|
57 <tr><td>ZoomLevelDefault</td></tr><tr><td>ZoomLevels</td></tr> |
|
58 </table> |
|
59 <h3>Class Methods</h3> |
|
60 <table> |
|
61 <tr><td>None</td></tr> |
|
62 </table> |
|
63 <h3>Methods</h3> |
|
64 <table> |
|
65 <tr> |
|
66 <td><a href="#E5GraphicsView.__init__">E5GraphicsView</a></td> |
|
67 <td>Constructor</td> |
|
68 </tr><tr> |
|
69 <td><a href="#E5GraphicsView.__getDiagram">__getDiagram</a></td> |
|
70 <td>Private method to retrieve the diagram from the scene fitting it in the minimum rectangle.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#E5GraphicsView.__levelForZoom">__levelForZoom</a></td> |
|
73 <td>Private method determining the zoom level index given a zoom factor.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#E5GraphicsView._getDiagramRect">_getDiagramRect</a></td> |
|
76 <td>Protected method to calculate the minimum rectangle fitting the diagram.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#E5GraphicsView._getDiagramSize">_getDiagramSize</a></td> |
|
79 <td>Protected method to calculate the minimum size fitting the diagram.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#E5GraphicsView.autoAdjustSceneSize">autoAdjustSceneSize</a></td> |
|
82 <td>Public method to adjust the scene size to the diagram size.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#E5GraphicsView.filteredItems">filteredItems</a></td> |
|
85 <td>Public method to filter a list of items.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#E5GraphicsView.printDiagram">printDiagram</a></td> |
|
88 <td>Public method to print the diagram.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#E5GraphicsView.resizeScene">resizeScene</a></td> |
|
91 <td>Public method to resize the scene.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#E5GraphicsView.saveImage">saveImage</a></td> |
|
94 <td>Public method to save the scene to a file.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#E5GraphicsView.setSceneSize">setSceneSize</a></td> |
|
97 <td>Public method to set the scene size.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#E5GraphicsView.setZoom">setZoom</a></td> |
|
100 <td>Public method to set the zoom value in percent.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#E5GraphicsView.zoom">zoom</a></td> |
|
103 <td>Public method to get the current zoom factor in percent.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#E5GraphicsView.zoomIn">zoomIn</a></td> |
|
106 <td>Public method to zoom in.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#E5GraphicsView.zoomOut">zoomOut</a></td> |
|
109 <td>Public method to zoom out.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#E5GraphicsView.zoomReset">zoomReset</a></td> |
|
112 <td>Public method to handle the reset the zoom value.</td> |
|
113 </tr> |
|
114 </table> |
|
115 <h3>Static Methods</h3> |
|
116 <table> |
|
117 <tr><td>None</td></tr> |
|
118 </table> |
|
119 <a NAME="E5GraphicsView.__init__" ID="E5GraphicsView.__init__"></a> |
|
120 <h4>E5GraphicsView (Constructor)</h4> |
|
121 <b>E5GraphicsView</b>(<i>scene, parent=None</i>) |
|
122 <p> |
|
123 Constructor |
|
124 </p><dl> |
|
125 <dt><i>scene</i></dt> |
|
126 <dd> |
|
127 reference to the scene object (QGraphicsScene) |
|
128 </dd><dt><i>parent</i></dt> |
|
129 <dd> |
|
130 parent widget (QWidget) |
|
131 </dd> |
|
132 </dl><a NAME="E5GraphicsView.__getDiagram" ID="E5GraphicsView.__getDiagram"></a> |
|
133 <h4>E5GraphicsView.__getDiagram</h4> |
|
134 <b>__getDiagram</b>(<i>rect, imageFormat="PNG", filename=None</i>) |
|
135 <p> |
|
136 Private method to retrieve the diagram from the scene fitting it |
|
137 in the minimum rectangle. |
|
138 </p><dl> |
|
139 <dt><i>rect</i></dt> |
|
140 <dd> |
|
141 minimum rectangle fitting the diagram (QRectF) |
|
142 </dd><dt><i>imageFormat</i></dt> |
|
143 <dd> |
|
144 format for the image file (string) |
|
145 </dd><dt><i>filename</i></dt> |
|
146 <dd> |
|
147 name of the file for non pixmaps (string) |
|
148 </dd> |
|
149 </dl><dl> |
|
150 <dt>Returns:</dt> |
|
151 <dd> |
|
152 diagram pixmap to receive the diagram (QPixmap) |
|
153 </dd> |
|
154 </dl><a NAME="E5GraphicsView.__levelForZoom" ID="E5GraphicsView.__levelForZoom"></a> |
|
155 <h4>E5GraphicsView.__levelForZoom</h4> |
|
156 <b>__levelForZoom</b>(<i>zoom</i>) |
|
157 <p> |
|
158 Private method determining the zoom level index given a zoom factor. |
|
159 </p><dl> |
|
160 <dt><i>zoom</i></dt> |
|
161 <dd> |
|
162 zoom factor (integer) |
|
163 </dd> |
|
164 </dl><dl> |
|
165 <dt>Returns:</dt> |
|
166 <dd> |
|
167 index of zoom factor (integer) |
|
168 </dd> |
|
169 </dl><a NAME="E5GraphicsView._getDiagramRect" ID="E5GraphicsView._getDiagramRect"></a> |
|
170 <h4>E5GraphicsView._getDiagramRect</h4> |
|
171 <b>_getDiagramRect</b>(<i>border=0</i>) |
|
172 <p> |
|
173 Protected method to calculate the minimum rectangle fitting the |
|
174 diagram. |
|
175 </p><dl> |
|
176 <dt><i>border</i></dt> |
|
177 <dd> |
|
178 border width to include in the calculation (integer) |
|
179 </dd> |
|
180 </dl><dl> |
|
181 <dt>Returns:</dt> |
|
182 <dd> |
|
183 the minimum rectangle (QRectF) |
|
184 </dd> |
|
185 </dl><a NAME="E5GraphicsView._getDiagramSize" ID="E5GraphicsView._getDiagramSize"></a> |
|
186 <h4>E5GraphicsView._getDiagramSize</h4> |
|
187 <b>_getDiagramSize</b>(<i>border=0</i>) |
|
188 <p> |
|
189 Protected method to calculate the minimum size fitting the diagram. |
|
190 </p><dl> |
|
191 <dt><i>border</i></dt> |
|
192 <dd> |
|
193 border width to include in the calculation (integer) |
|
194 </dd> |
|
195 </dl><dl> |
|
196 <dt>Returns:</dt> |
|
197 <dd> |
|
198 the minimum size (QSizeF) |
|
199 </dd> |
|
200 </dl><a NAME="E5GraphicsView.autoAdjustSceneSize" ID="E5GraphicsView.autoAdjustSceneSize"></a> |
|
201 <h4>E5GraphicsView.autoAdjustSceneSize</h4> |
|
202 <b>autoAdjustSceneSize</b>(<i>limit=False</i>) |
|
203 <p> |
|
204 Public method to adjust the scene size to the diagram size. |
|
205 </p><dl> |
|
206 <dt><i>limit</i></dt> |
|
207 <dd> |
|
208 flag indicating to limit the scene to the |
|
209 initial size (boolean) |
|
210 </dd> |
|
211 </dl><a NAME="E5GraphicsView.filteredItems" ID="E5GraphicsView.filteredItems"></a> |
|
212 <h4>E5GraphicsView.filteredItems</h4> |
|
213 <b>filteredItems</b>(<i>items</i>) |
|
214 <p> |
|
215 Public method to filter a list of items. |
|
216 </p><dl> |
|
217 <dt><i>items</i></dt> |
|
218 <dd> |
|
219 list of items as returned by the scene object |
|
220 (QGraphicsItem) |
|
221 </dd> |
|
222 </dl><dl> |
|
223 <dt>Returns:</dt> |
|
224 <dd> |
|
225 list of interesting collision items (QGraphicsItem) |
|
226 </dd> |
|
227 </dl><a NAME="E5GraphicsView.printDiagram" ID="E5GraphicsView.printDiagram"></a> |
|
228 <h4>E5GraphicsView.printDiagram</h4> |
|
229 <b>printDiagram</b>(<i>printer, diagramName=""</i>) |
|
230 <p> |
|
231 Public method to print the diagram. |
|
232 </p><dl> |
|
233 <dt><i>printer</i></dt> |
|
234 <dd> |
|
235 reference to a ready configured printer object |
|
236 (QPrinter) |
|
237 </dd><dt><i>diagramName</i></dt> |
|
238 <dd> |
|
239 name of the diagram (string) |
|
240 </dd> |
|
241 </dl><a NAME="E5GraphicsView.resizeScene" ID="E5GraphicsView.resizeScene"></a> |
|
242 <h4>E5GraphicsView.resizeScene</h4> |
|
243 <b>resizeScene</b>(<i>amount, isWidth=True</i>) |
|
244 <p> |
|
245 Public method to resize the scene. |
|
246 </p><dl> |
|
247 <dt><i>amount</i></dt> |
|
248 <dd> |
|
249 size increment (integer) |
|
250 </dd><dt><i>isWidth</i></dt> |
|
251 <dd> |
|
252 flag indicating width is to be resized (boolean) |
|
253 </dd> |
|
254 </dl><a NAME="E5GraphicsView.saveImage" ID="E5GraphicsView.saveImage"></a> |
|
255 <h4>E5GraphicsView.saveImage</h4> |
|
256 <b>saveImage</b>(<i>filename, imageFormat="PNG"</i>) |
|
257 <p> |
|
258 Public method to save the scene to a file. |
|
259 </p><dl> |
|
260 <dt><i>filename</i></dt> |
|
261 <dd> |
|
262 name of the file to write the image to (string) |
|
263 </dd><dt><i>imageFormat</i></dt> |
|
264 <dd> |
|
265 format for the image file (string) |
|
266 </dd> |
|
267 </dl><dl> |
|
268 <dt>Returns:</dt> |
|
269 <dd> |
|
270 flag indicating success (boolean) |
|
271 </dd> |
|
272 </dl><a NAME="E5GraphicsView.setSceneSize" ID="E5GraphicsView.setSceneSize"></a> |
|
273 <h4>E5GraphicsView.setSceneSize</h4> |
|
274 <b>setSceneSize</b>(<i>width, height</i>) |
|
275 <p> |
|
276 Public method to set the scene size. |
|
277 </p><dl> |
|
278 <dt><i>width</i></dt> |
|
279 <dd> |
|
280 width for the scene (real) |
|
281 </dd><dt><i>height</i></dt> |
|
282 <dd> |
|
283 height for the scene (real) |
|
284 </dd> |
|
285 </dl><a NAME="E5GraphicsView.setZoom" ID="E5GraphicsView.setZoom"></a> |
|
286 <h4>E5GraphicsView.setZoom</h4> |
|
287 <b>setZoom</b>(<i>value</i>) |
|
288 <p> |
|
289 Public method to set the zoom value in percent. |
|
290 </p><dl> |
|
291 <dt><i>value</i></dt> |
|
292 <dd> |
|
293 zoom value in percent (integer) |
|
294 </dd> |
|
295 </dl><a NAME="E5GraphicsView.zoom" ID="E5GraphicsView.zoom"></a> |
|
296 <h4>E5GraphicsView.zoom</h4> |
|
297 <b>zoom</b>(<i></i>) |
|
298 <p> |
|
299 Public method to get the current zoom factor in percent. |
|
300 </p><dl> |
|
301 <dt>Returns:</dt> |
|
302 <dd> |
|
303 current zoom factor in percent (integer) |
|
304 </dd> |
|
305 </dl><a NAME="E5GraphicsView.zoomIn" ID="E5GraphicsView.zoomIn"></a> |
|
306 <h4>E5GraphicsView.zoomIn</h4> |
|
307 <b>zoomIn</b>(<i></i>) |
|
308 <p> |
|
309 Public method to zoom in. |
|
310 </p><a NAME="E5GraphicsView.zoomOut" ID="E5GraphicsView.zoomOut"></a> |
|
311 <h4>E5GraphicsView.zoomOut</h4> |
|
312 <b>zoomOut</b>(<i></i>) |
|
313 <p> |
|
314 Public method to zoom out. |
|
315 </p><a NAME="E5GraphicsView.zoomReset" ID="E5GraphicsView.zoomReset"></a> |
|
316 <h4>E5GraphicsView.zoomReset</h4> |
|
317 <b>zoomReset</b>(<i></i>) |
|
318 <p> |
|
319 Public method to handle the reset the zoom value. |
|
320 </p> |
|
321 <div align="right"><a href="#top">Up</a></div> |
|
322 <hr /> |
|
323 </body></html> |