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