|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric5.E5Gui.E5MapWidget</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>eric5.E5Gui.E5MapWidget</h1> |
|
23 <p> |
|
24 Module implementing a base class for showing a document map. |
|
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="#E5MapWidget">E5MapWidget</a></td> |
|
34 <td>Class implementing a base class for showing a document map.</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="E5MapWidget" ID="E5MapWidget"></a> |
|
43 <h2>E5MapWidget</h2> |
|
44 <p> |
|
45 Class implementing a base class for showing a document map. |
|
46 </p> |
|
47 <h3>Derived from</h3> |
|
48 QWidget |
|
49 <h3>Class Attributes</h3> |
|
50 <table> |
|
51 <tr><td>None</td></tr> |
|
52 </table> |
|
53 <h3>Class Methods</h3> |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 <table> |
|
59 <tr> |
|
60 <td><a href="#E5MapWidget.__init__">E5MapWidget</a></td> |
|
61 <td>Constructor</td> |
|
62 </tr><tr> |
|
63 <td><a href="#E5MapWidget.__generateSliderRange">__generateSliderRange</a></td> |
|
64 <td>Private method to generate the slider rectangle.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#E5MapWidget.__setSliderColor">__setSliderColor</a></td> |
|
67 <td>Set the slider color depending upon the background color.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#E5MapWidget.__updateMasterViewportWidth">__updateMasterViewportWidth</a></td> |
|
70 <td>Private method to update the master's viewport width.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#E5MapWidget._paintIt">_paintIt</a></td> |
|
73 <td>Protected method for painting the widget's indicators.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#E5MapWidget.backgroundColor">backgroundColor</a></td> |
|
76 <td>Public method to get the background color.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#E5MapWidget.calculateGeometry">calculateGeometry</a></td> |
|
79 <td>Public method to recalculate the map widget's geometry.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#E5MapWidget.generateIndicatorRect">generateIndicatorRect</a></td> |
|
82 <td>Public method to generate an indicator rectangle.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#E5MapWidget.isEnabled">isEnabled</a></td> |
|
85 <td>Public method to check the enabled state.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#E5MapWidget.lineDimensions">lineDimensions</a></td> |
|
88 <td>Public method to get the line (indicator) dimensions.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#E5MapWidget.mouseMoveEvent">mouseMoveEvent</a></td> |
|
91 <td>Protected method to handle a mouse moves.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#E5MapWidget.mousePressEvent">mousePressEvent</a></td> |
|
94 <td>Protected method to handle a mouse button press.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#E5MapWidget.paintEvent">paintEvent</a></td> |
|
97 <td>Protected method to handle a paint event.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#E5MapWidget.position2Value">position2Value</a></td> |
|
100 <td>Public method to convert a position into a scrollbar value.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#E5MapWidget.scaleFactor">scaleFactor</a></td> |
|
103 <td>Public method to determine the scrollbar's scale factor.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#E5MapWidget.setBackgroundColor">setBackgroundColor</a></td> |
|
106 <td>Public method to set the widget background color.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#E5MapWidget.setEnabled">setEnabled</a></td> |
|
109 <td>Public method to set the enabled state.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#E5MapWidget.setLineDimensions">setLineDimensions</a></td> |
|
112 <td>Public method to set the line (indicator) dimensions.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#E5MapWidget.setMaster">setMaster</a></td> |
|
115 <td>Public method to set the map master widget.</td> |
|
116 </tr><tr> |
|
117 <td><a href="#E5MapWidget.setWidth">setWidth</a></td> |
|
118 <td>Public method to set the widget width.</td> |
|
119 </tr><tr> |
|
120 <td><a href="#E5MapWidget.sizeHint">sizeHint</a></td> |
|
121 <td>Public method to give an indication about the preferred size.</td> |
|
122 </tr><tr> |
|
123 <td><a href="#E5MapWidget.value2Position">value2Position</a></td> |
|
124 <td>Public method to convert a scrollbar value into a position.</td> |
|
125 </tr><tr> |
|
126 <td><a href="#E5MapWidget.wheelEvent">wheelEvent</a></td> |
|
127 <td>Protected slot handling mouse wheel events.</td> |
|
128 </tr><tr> |
|
129 <td><a href="#E5MapWidget.width">width</a></td> |
|
130 <td>Public method to get the widget's width.</td> |
|
131 </tr> |
|
132 </table> |
|
133 <h3>Static Methods</h3> |
|
134 <table> |
|
135 <tr><td>None</td></tr> |
|
136 </table> |
|
137 <a NAME="E5MapWidget.__init__" ID="E5MapWidget.__init__"></a> |
|
138 <h4>E5MapWidget (Constructor)</h4> |
|
139 <b>E5MapWidget</b>(<i>parent=None</i>) |
|
140 <p> |
|
141 Constructor |
|
142 </p><dl> |
|
143 <dt><i>parent</i></dt> |
|
144 <dd> |
|
145 reference to the parent widget (QWidget) |
|
146 </dd> |
|
147 </dl><a NAME="E5MapWidget.__generateSliderRange" ID="E5MapWidget.__generateSliderRange"></a> |
|
148 <h4>E5MapWidget.__generateSliderRange</h4> |
|
149 <b>__generateSliderRange</b>(<i>scrollbar</i>) |
|
150 <p> |
|
151 Private method to generate the slider rectangle. |
|
152 </p><dl> |
|
153 <dt><i>scrollbar</i></dt> |
|
154 <dd> |
|
155 reference to the vertical scrollbar (QScrollBar) |
|
156 </dd> |
|
157 </dl><dl> |
|
158 <dt>Returns:</dt> |
|
159 <dd> |
|
160 slider rectangle (QRect) |
|
161 </dd> |
|
162 </dl><a NAME="E5MapWidget.__setSliderColor" ID="E5MapWidget.__setSliderColor"></a> |
|
163 <h4>E5MapWidget.__setSliderColor</h4> |
|
164 <b>__setSliderColor</b>(<i></i>) |
|
165 <p> |
|
166 Set the slider color depending upon the background color. |
|
167 </p><a NAME="E5MapWidget.__updateMasterViewportWidth" ID="E5MapWidget.__updateMasterViewportWidth"></a> |
|
168 <h4>E5MapWidget.__updateMasterViewportWidth</h4> |
|
169 <b>__updateMasterViewportWidth</b>(<i></i>) |
|
170 <p> |
|
171 Private method to update the master's viewport width. |
|
172 </p><a NAME="E5MapWidget._paintIt" ID="E5MapWidget._paintIt"></a> |
|
173 <h4>E5MapWidget._paintIt</h4> |
|
174 <b>_paintIt</b>(<i>painter</i>) |
|
175 <p> |
|
176 Protected method for painting the widget's indicators. |
|
177 </p><p> |
|
178 Note: This method should be implemented by subclasses. |
|
179 </p><dl> |
|
180 <dt><i>painter</i></dt> |
|
181 <dd> |
|
182 reference to the painter object (QPainter) |
|
183 </dd> |
|
184 </dl><a NAME="E5MapWidget.backgroundColor" ID="E5MapWidget.backgroundColor"></a> |
|
185 <h4>E5MapWidget.backgroundColor</h4> |
|
186 <b>backgroundColor</b>(<i></i>) |
|
187 <p> |
|
188 Public method to get the background color. |
|
189 </p><dl> |
|
190 <dt>Returns:</dt> |
|
191 <dd> |
|
192 background color (QColor) |
|
193 </dd> |
|
194 </dl><a NAME="E5MapWidget.calculateGeometry" ID="E5MapWidget.calculateGeometry"></a> |
|
195 <h4>E5MapWidget.calculateGeometry</h4> |
|
196 <b>calculateGeometry</b>(<i></i>) |
|
197 <p> |
|
198 Public method to recalculate the map widget's geometry. |
|
199 </p><a NAME="E5MapWidget.generateIndicatorRect" ID="E5MapWidget.generateIndicatorRect"></a> |
|
200 <h4>E5MapWidget.generateIndicatorRect</h4> |
|
201 <b>generateIndicatorRect</b>(<i>position</i>) |
|
202 <p> |
|
203 Public method to generate an indicator rectangle. |
|
204 </p><dl> |
|
205 <dt><i>position</i></dt> |
|
206 <dd> |
|
207 indicator position (integer) |
|
208 </dd> |
|
209 </dl><dl> |
|
210 <dt>Returns:</dt> |
|
211 <dd> |
|
212 indicator rectangle (QRect) |
|
213 </dd> |
|
214 </dl><a NAME="E5MapWidget.isEnabled" ID="E5MapWidget.isEnabled"></a> |
|
215 <h4>E5MapWidget.isEnabled</h4> |
|
216 <b>isEnabled</b>(<i></i>) |
|
217 <p> |
|
218 Public method to check the enabled state. |
|
219 </p><dl> |
|
220 <dt>Returns:</dt> |
|
221 <dd> |
|
222 flag indicating the enabled state (boolean) |
|
223 </dd> |
|
224 </dl><a NAME="E5MapWidget.lineDimensions" ID="E5MapWidget.lineDimensions"></a> |
|
225 <h4>E5MapWidget.lineDimensions</h4> |
|
226 <b>lineDimensions</b>(<i></i>) |
|
227 <p> |
|
228 Public method to get the line (indicator) dimensions. |
|
229 </p><dl> |
|
230 <dt>Returns:</dt> |
|
231 <dd> |
|
232 tuple with border width (integer) and line height (integer) |
|
233 </dd> |
|
234 </dl><a NAME="E5MapWidget.mouseMoveEvent" ID="E5MapWidget.mouseMoveEvent"></a> |
|
235 <h4>E5MapWidget.mouseMoveEvent</h4> |
|
236 <b>mouseMoveEvent</b>(<i>event</i>) |
|
237 <p> |
|
238 Protected method to handle a mouse moves. |
|
239 </p><dl> |
|
240 <dt><i>event</i></dt> |
|
241 <dd> |
|
242 reference to the mouse event (QMouseEvent) |
|
243 </dd> |
|
244 </dl><a NAME="E5MapWidget.mousePressEvent" ID="E5MapWidget.mousePressEvent"></a> |
|
245 <h4>E5MapWidget.mousePressEvent</h4> |
|
246 <b>mousePressEvent</b>(<i>event</i>) |
|
247 <p> |
|
248 Protected method to handle a mouse button press. |
|
249 </p><dl> |
|
250 <dt><i>event</i></dt> |
|
251 <dd> |
|
252 reference to the mouse event (QMouseEvent) |
|
253 </dd> |
|
254 </dl><a NAME="E5MapWidget.paintEvent" ID="E5MapWidget.paintEvent"></a> |
|
255 <h4>E5MapWidget.paintEvent</h4> |
|
256 <b>paintEvent</b>(<i>event</i>) |
|
257 <p> |
|
258 Protected method to handle a paint event. |
|
259 </p><dl> |
|
260 <dt><i>event</i></dt> |
|
261 <dd> |
|
262 paint event (QPaintEvent) |
|
263 </dd> |
|
264 </dl><a NAME="E5MapWidget.position2Value" ID="E5MapWidget.position2Value"></a> |
|
265 <h4>E5MapWidget.position2Value</h4> |
|
266 <b>position2Value</b>(<i>position, slider=False</i>) |
|
267 <p> |
|
268 Public method to convert a position into a scrollbar value. |
|
269 </p><dl> |
|
270 <dt><i>position</i></dt> |
|
271 <dd> |
|
272 scrollbar position to convert (integer) |
|
273 </dd><dt><i>slider</i></dt> |
|
274 <dd> |
|
275 flag indicating to calculate the result for the slider |
|
276 (boolean) |
|
277 </dd> |
|
278 </dl><dl> |
|
279 <dt>Returns:</dt> |
|
280 <dd> |
|
281 scrollbar value (integer) |
|
282 </dd> |
|
283 </dl><a NAME="E5MapWidget.scaleFactor" ID="E5MapWidget.scaleFactor"></a> |
|
284 <h4>E5MapWidget.scaleFactor</h4> |
|
285 <b>scaleFactor</b>(<i>slider=False</i>) |
|
286 <p> |
|
287 Public method to determine the scrollbar's scale factor. |
|
288 </p><dl> |
|
289 <dt><i>slider</i></dt> |
|
290 <dd> |
|
291 flag indicating to calculate the result for the slider |
|
292 (boolean) |
|
293 </dd> |
|
294 </dl><dl> |
|
295 <dt>Returns:</dt> |
|
296 <dd> |
|
297 scale factor (float) |
|
298 </dd> |
|
299 </dl><a NAME="E5MapWidget.setBackgroundColor" ID="E5MapWidget.setBackgroundColor"></a> |
|
300 <h4>E5MapWidget.setBackgroundColor</h4> |
|
301 <b>setBackgroundColor</b>(<i>color</i>) |
|
302 <p> |
|
303 Public method to set the widget background color. |
|
304 </p><dl> |
|
305 <dt><i>color</i></dt> |
|
306 <dd> |
|
307 color for the background (QColor) |
|
308 </dd> |
|
309 </dl><a NAME="E5MapWidget.setEnabled" ID="E5MapWidget.setEnabled"></a> |
|
310 <h4>E5MapWidget.setEnabled</h4> |
|
311 <b>setEnabled</b>(<i>enable</i>) |
|
312 <p> |
|
313 Public method to set the enabled state. |
|
314 </p><dl> |
|
315 <dt><i>enable</i></dt> |
|
316 <dd> |
|
317 flag indicating the enabled state (boolean) |
|
318 </dd> |
|
319 </dl><a NAME="E5MapWidget.setLineDimensions" ID="E5MapWidget.setLineDimensions"></a> |
|
320 <h4>E5MapWidget.setLineDimensions</h4> |
|
321 <b>setLineDimensions</b>(<i>border, height</i>) |
|
322 <p> |
|
323 Public method to set the line (indicator) dimensions. |
|
324 </p><dl> |
|
325 <dt><i>border</i></dt> |
|
326 <dd> |
|
327 border width on each side in x-direction (integer) |
|
328 </dd><dt><i>height</i></dt> |
|
329 <dd> |
|
330 height of the line in pixels (integer) |
|
331 </dd> |
|
332 </dl><a NAME="E5MapWidget.setMaster" ID="E5MapWidget.setMaster"></a> |
|
333 <h4>E5MapWidget.setMaster</h4> |
|
334 <b>setMaster</b>(<i>master</i>) |
|
335 <p> |
|
336 Public method to set the map master widget. |
|
337 </p><dl> |
|
338 <dt><i>master</i></dt> |
|
339 <dd> |
|
340 map master widget (QAbstractScrollArea) |
|
341 </dd> |
|
342 </dl><a NAME="E5MapWidget.setWidth" ID="E5MapWidget.setWidth"></a> |
|
343 <h4>E5MapWidget.setWidth</h4> |
|
344 <b>setWidth</b>(<i>width</i>) |
|
345 <p> |
|
346 Public method to set the widget width. |
|
347 </p><dl> |
|
348 <dt><i>width</i></dt> |
|
349 <dd> |
|
350 widget width (integer) |
|
351 </dd> |
|
352 </dl><a NAME="E5MapWidget.sizeHint" ID="E5MapWidget.sizeHint"></a> |
|
353 <h4>E5MapWidget.sizeHint</h4> |
|
354 <b>sizeHint</b>(<i></i>) |
|
355 <p> |
|
356 Public method to give an indication about the preferred size. |
|
357 </p><dl> |
|
358 <dt>Returns:</dt> |
|
359 <dd> |
|
360 preferred size (QSize) |
|
361 </dd> |
|
362 </dl><a NAME="E5MapWidget.value2Position" ID="E5MapWidget.value2Position"></a> |
|
363 <h4>E5MapWidget.value2Position</h4> |
|
364 <b>value2Position</b>(<i>value, slider=False</i>) |
|
365 <p> |
|
366 Public method to convert a scrollbar value into a position. |
|
367 </p><dl> |
|
368 <dt><i>value</i></dt> |
|
369 <dd> |
|
370 value to convert (integer) |
|
371 </dd><dt><i>slider</i></dt> |
|
372 <dd> |
|
373 flag indicating to calculate the result for the slider |
|
374 (boolean) |
|
375 </dd> |
|
376 </dl><dl> |
|
377 <dt>Returns:</dt> |
|
378 <dd> |
|
379 position (integer) |
|
380 </dd> |
|
381 </dl><a NAME="E5MapWidget.wheelEvent" ID="E5MapWidget.wheelEvent"></a> |
|
382 <h4>E5MapWidget.wheelEvent</h4> |
|
383 <b>wheelEvent</b>(<i>event</i>) |
|
384 <p> |
|
385 Protected slot handling mouse wheel events. |
|
386 </p><dl> |
|
387 <dt><i>event</i></dt> |
|
388 <dd> |
|
389 reference to the wheel event (QWheelEvent) |
|
390 </dd> |
|
391 </dl><a NAME="E5MapWidget.width" ID="E5MapWidget.width"></a> |
|
392 <h4>E5MapWidget.width</h4> |
|
393 <b>width</b>(<i></i>) |
|
394 <p> |
|
395 Public method to get the widget's width. |
|
396 </p><dl> |
|
397 <dt>Returns:</dt> |
|
398 <dd> |
|
399 widget width (integer) |
|
400 </dd> |
|
401 </dl> |
|
402 <div align="right"><a href="#top">Up</a></div> |
|
403 <hr /> |
|
404 </body></html> |