|
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>eric5.E5Graphics.E5GraphicsView</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>eric5.E5Graphics.E5GraphicsView</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="#E5GraphicsView">E5GraphicsView</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="E5GraphicsView" ID="E5GraphicsView"></a> |
|
44 <h2>E5GraphicsView</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="#E5GraphicsView.__init__">E5GraphicsView</a></td> |
|
58 <td>Constructor</td> |
|
59 </tr><tr> |
|
60 <td><a href="#E5GraphicsView.__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="#E5GraphicsView._getDiagramRect">_getDiagramRect</a></td> |
|
64 <td>Protected method to calculate the minimum rectangle fitting the diagram.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#E5GraphicsView._getDiagramSize">_getDiagramSize</a></td> |
|
67 <td>Protected method to calculate the minimum size fitting the diagram.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#E5GraphicsView.filteredItems">filteredItems</a></td> |
|
70 <td>Public method to filter a list of items.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#E5GraphicsView.printDiagram">printDiagram</a></td> |
|
73 <td>Public method to print the diagram.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#E5GraphicsView.resizeScene">resizeScene</a></td> |
|
76 <td>Public method to resize the scene.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#E5GraphicsView.saveImage">saveImage</a></td> |
|
79 <td>Public method to save the scene to a file.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#E5GraphicsView.setSceneSize">setSceneSize</a></td> |
|
82 <td>Public method to set the scene size.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#E5GraphicsView.setZoom">setZoom</a></td> |
|
85 <td>Public method to set the zoom factor.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#E5GraphicsView.zoom">zoom</a></td> |
|
88 <td>Public method to get the current zoom factor.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#E5GraphicsView.zoomIn">zoomIn</a></td> |
|
91 <td>Public method to zoom in.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#E5GraphicsView.zoomOut">zoomOut</a></td> |
|
94 <td>Public method to zoom out.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#E5GraphicsView.zoomReset">zoomReset</a></td> |
|
97 <td>Public method to handle the reset zoom context menu entry.</td> |
|
98 </tr> |
|
99 </table> |
|
100 <a NAME="E5GraphicsView.__init__" ID="E5GraphicsView.__init__"></a> |
|
101 <h4>E5GraphicsView (Constructor)</h4> |
|
102 <b>E5GraphicsView</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="E5GraphicsView.__getDiagram" ID="E5GraphicsView.__getDiagram"></a> |
|
114 <h4>E5GraphicsView.__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="E5GraphicsView._getDiagramRect" ID="E5GraphicsView._getDiagramRect"></a> |
|
136 <h4>E5GraphicsView._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="E5GraphicsView._getDiagramSize" ID="E5GraphicsView._getDiagramSize"></a> |
|
151 <h4>E5GraphicsView._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="E5GraphicsView.filteredItems" ID="E5GraphicsView.filteredItems"></a> |
|
166 <h4>E5GraphicsView.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="E5GraphicsView.printDiagram" ID="E5GraphicsView.printDiagram"></a> |
|
182 <h4>E5GraphicsView.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="E5GraphicsView.resizeScene" ID="E5GraphicsView.resizeScene"></a> |
|
195 <h4>E5GraphicsView.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="E5GraphicsView.saveImage" ID="E5GraphicsView.saveImage"></a> |
|
208 <h4>E5GraphicsView.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="E5GraphicsView.setSceneSize" ID="E5GraphicsView.setSceneSize"></a> |
|
226 <h4>E5GraphicsView.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="E5GraphicsView.setZoom" ID="E5GraphicsView.setZoom"></a> |
|
239 <h4>E5GraphicsView.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="E5GraphicsView.zoom" ID="E5GraphicsView.zoom"></a> |
|
249 <h4>E5GraphicsView.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="E5GraphicsView.zoomIn" ID="E5GraphicsView.zoomIn"></a> |
|
259 <h4>E5GraphicsView.zoomIn</h4> |
|
260 <b>zoomIn</b>(<i></i>) |
|
261 <p> |
|
262 Public method to zoom in. |
|
263 </p><a NAME="E5GraphicsView.zoomOut" ID="E5GraphicsView.zoomOut"></a> |
|
264 <h4>E5GraphicsView.zoomOut</h4> |
|
265 <b>zoomOut</b>(<i></i>) |
|
266 <p> |
|
267 Public method to zoom out. |
|
268 </p><a NAME="E5GraphicsView.zoomReset" ID="E5GraphicsView.zoomReset"></a> |
|
269 <h4>E5GraphicsView.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> |