|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.EricWidgets.EricMapWidget</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.EricWidgets.EricMapWidget</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a base class for showing a document map. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#EricMapWidget">EricMapWidget</a></td> |
|
25 <td>Class implementing a base class for showing a document map.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <hr /> |
|
34 <hr /> |
|
35 <a NAME="EricMapWidget" ID="EricMapWidget"></a> |
|
36 <h2>EricMapWidget</h2> |
|
37 |
|
38 <p> |
|
39 Class implementing a base class for showing a document map. |
|
40 </p> |
|
41 <h3>Derived from</h3> |
|
42 QWidget |
|
43 <h3>Class Attributes</h3> |
|
44 |
|
45 <table> |
|
46 <tr><td>None</td></tr> |
|
47 </table> |
|
48 <h3>Class Methods</h3> |
|
49 |
|
50 <table> |
|
51 <tr><td>None</td></tr> |
|
52 </table> |
|
53 <h3>Methods</h3> |
|
54 |
|
55 <table> |
|
56 |
|
57 <tr> |
|
58 <td><a href="#EricMapWidget.__init__">EricMapWidget</a></td> |
|
59 <td>Constructor</td> |
|
60 </tr> |
|
61 <tr> |
|
62 <td><a href="#EricMapWidget.__generateSliderRange">__generateSliderRange</a></td> |
|
63 <td>Private method to generate the slider rectangle.</td> |
|
64 </tr> |
|
65 <tr> |
|
66 <td><a href="#EricMapWidget.__setSliderColor">__setSliderColor</a></td> |
|
67 <td>Private method to set the slider color depending upon the background color.</td> |
|
68 </tr> |
|
69 <tr> |
|
70 <td><a href="#EricMapWidget.__updateMasterViewportWidth">__updateMasterViewportWidth</a></td> |
|
71 <td>Private method to update the master's viewport width.</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#EricMapWidget._paintIt">_paintIt</a></td> |
|
75 <td>Protected method for painting the widget's indicators.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#EricMapWidget.backgroundColor">backgroundColor</a></td> |
|
79 <td>Public method to get the background color.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#EricMapWidget.calculateGeometry">calculateGeometry</a></td> |
|
83 <td>Public method to recalculate the map widget's geometry.</td> |
|
84 </tr> |
|
85 <tr> |
|
86 <td><a href="#EricMapWidget.generateIndicatorRect">generateIndicatorRect</a></td> |
|
87 <td>Public method to generate an indicator rectangle.</td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td><a href="#EricMapWidget.isEnabled">isEnabled</a></td> |
|
91 <td>Public method to check the enabled state.</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#EricMapWidget.isOnRightSide">isOnRightSide</a></td> |
|
95 <td>Public method to test, if the map is shown on the right side of the master widget.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#EricMapWidget.lineDimensions">lineDimensions</a></td> |
|
99 <td>Public method to get the line (indicator) dimensions.</td> |
|
100 </tr> |
|
101 <tr> |
|
102 <td><a href="#EricMapWidget.mouseMoveEvent">mouseMoveEvent</a></td> |
|
103 <td>Protected method to handle a mouse moves.</td> |
|
104 </tr> |
|
105 <tr> |
|
106 <td><a href="#EricMapWidget.mousePressEvent">mousePressEvent</a></td> |
|
107 <td>Protected method to handle a mouse button press.</td> |
|
108 </tr> |
|
109 <tr> |
|
110 <td><a href="#EricMapWidget.paintEvent">paintEvent</a></td> |
|
111 <td>Protected method to handle a paint event.</td> |
|
112 </tr> |
|
113 <tr> |
|
114 <td><a href="#EricMapWidget.position2Value">position2Value</a></td> |
|
115 <td>Public method to convert a position into a scrollbar value.</td> |
|
116 </tr> |
|
117 <tr> |
|
118 <td><a href="#EricMapWidget.scaleFactor">scaleFactor</a></td> |
|
119 <td>Public method to determine the scrollbar's scale factor.</td> |
|
120 </tr> |
|
121 <tr> |
|
122 <td><a href="#EricMapWidget.setBackgroundColor">setBackgroundColor</a></td> |
|
123 <td>Public method to set the widget background color.</td> |
|
124 </tr> |
|
125 <tr> |
|
126 <td><a href="#EricMapWidget.setEnabled">setEnabled</a></td> |
|
127 <td>Public method to set the enabled state.</td> |
|
128 </tr> |
|
129 <tr> |
|
130 <td><a href="#EricMapWidget.setLineDimensions">setLineDimensions</a></td> |
|
131 <td>Public method to set the line (indicator) dimensions.</td> |
|
132 </tr> |
|
133 <tr> |
|
134 <td><a href="#EricMapWidget.setMapPosition">setMapPosition</a></td> |
|
135 <td>Public method to set, whether the map should be shown to the right or left of the master widget.</td> |
|
136 </tr> |
|
137 <tr> |
|
138 <td><a href="#EricMapWidget.setMaster">setMaster</a></td> |
|
139 <td>Public method to set the map master widget.</td> |
|
140 </tr> |
|
141 <tr> |
|
142 <td><a href="#EricMapWidget.setWidth">setWidth</a></td> |
|
143 <td>Public method to set the widget width.</td> |
|
144 </tr> |
|
145 <tr> |
|
146 <td><a href="#EricMapWidget.sizeHint">sizeHint</a></td> |
|
147 <td>Public method to give an indication about the preferred size.</td> |
|
148 </tr> |
|
149 <tr> |
|
150 <td><a href="#EricMapWidget.value2Position">value2Position</a></td> |
|
151 <td>Public method to convert a scrollbar value into a position.</td> |
|
152 </tr> |
|
153 <tr> |
|
154 <td><a href="#EricMapWidget.wheelEvent">wheelEvent</a></td> |
|
155 <td>Protected slot handling mouse wheel events.</td> |
|
156 </tr> |
|
157 <tr> |
|
158 <td><a href="#EricMapWidget.width">width</a></td> |
|
159 <td>Public method to get the widget's width.</td> |
|
160 </tr> |
|
161 </table> |
|
162 <h3>Static Methods</h3> |
|
163 |
|
164 <table> |
|
165 <tr><td>None</td></tr> |
|
166 </table> |
|
167 |
|
168 <a NAME="EricMapWidget.__init__" ID="EricMapWidget.__init__"></a> |
|
169 <h4>EricMapWidget (Constructor)</h4> |
|
170 <b>EricMapWidget</b>(<i>parent=None</i>) |
|
171 |
|
172 <p> |
|
173 Constructor |
|
174 </p> |
|
175 <dl> |
|
176 |
|
177 <dt><i>parent</i></dt> |
|
178 <dd> |
|
179 reference to the parent widget (QWidget) |
|
180 </dd> |
|
181 </dl> |
|
182 <a NAME="EricMapWidget.__generateSliderRange" ID="EricMapWidget.__generateSliderRange"></a> |
|
183 <h4>EricMapWidget.__generateSliderRange</h4> |
|
184 <b>__generateSliderRange</b>(<i>scrollbar</i>) |
|
185 |
|
186 <p> |
|
187 Private method to generate the slider rectangle. |
|
188 </p> |
|
189 <dl> |
|
190 |
|
191 <dt><i>scrollbar</i></dt> |
|
192 <dd> |
|
193 reference to the vertical scrollbar (QScrollBar) |
|
194 </dd> |
|
195 </dl> |
|
196 <dl> |
|
197 <dt>Return:</dt> |
|
198 <dd> |
|
199 slider rectangle (QRect) |
|
200 </dd> |
|
201 </dl> |
|
202 <a NAME="EricMapWidget.__setSliderColor" ID="EricMapWidget.__setSliderColor"></a> |
|
203 <h4>EricMapWidget.__setSliderColor</h4> |
|
204 <b>__setSliderColor</b>(<i></i>) |
|
205 |
|
206 <p> |
|
207 Private method to set the slider color depending upon the background |
|
208 color. |
|
209 </p> |
|
210 <a NAME="EricMapWidget.__updateMasterViewportWidth" ID="EricMapWidget.__updateMasterViewportWidth"></a> |
|
211 <h4>EricMapWidget.__updateMasterViewportWidth</h4> |
|
212 <b>__updateMasterViewportWidth</b>(<i></i>) |
|
213 |
|
214 <p> |
|
215 Private method to update the master's viewport width. |
|
216 </p> |
|
217 <a NAME="EricMapWidget._paintIt" ID="EricMapWidget._paintIt"></a> |
|
218 <h4>EricMapWidget._paintIt</h4> |
|
219 <b>_paintIt</b>(<i>painter</i>) |
|
220 |
|
221 <p> |
|
222 Protected method for painting the widget's indicators. |
|
223 </p> |
|
224 <p> |
|
225 Note: This method should be implemented by subclasses. |
|
226 </p> |
|
227 <dl> |
|
228 |
|
229 <dt><i>painter</i></dt> |
|
230 <dd> |
|
231 reference to the painter object (QPainter) |
|
232 </dd> |
|
233 </dl> |
|
234 <a NAME="EricMapWidget.backgroundColor" ID="EricMapWidget.backgroundColor"></a> |
|
235 <h4>EricMapWidget.backgroundColor</h4> |
|
236 <b>backgroundColor</b>(<i></i>) |
|
237 |
|
238 <p> |
|
239 Public method to get the background color. |
|
240 </p> |
|
241 <dl> |
|
242 <dt>Return:</dt> |
|
243 <dd> |
|
244 background color (QColor) |
|
245 </dd> |
|
246 </dl> |
|
247 <a NAME="EricMapWidget.calculateGeometry" ID="EricMapWidget.calculateGeometry"></a> |
|
248 <h4>EricMapWidget.calculateGeometry</h4> |
|
249 <b>calculateGeometry</b>(<i></i>) |
|
250 |
|
251 <p> |
|
252 Public method to recalculate the map widget's geometry. |
|
253 </p> |
|
254 <a NAME="EricMapWidget.generateIndicatorRect" ID="EricMapWidget.generateIndicatorRect"></a> |
|
255 <h4>EricMapWidget.generateIndicatorRect</h4> |
|
256 <b>generateIndicatorRect</b>(<i>position</i>) |
|
257 |
|
258 <p> |
|
259 Public method to generate an indicator rectangle. |
|
260 </p> |
|
261 <dl> |
|
262 |
|
263 <dt><i>position</i></dt> |
|
264 <dd> |
|
265 indicator position (integer) |
|
266 </dd> |
|
267 </dl> |
|
268 <dl> |
|
269 <dt>Return:</dt> |
|
270 <dd> |
|
271 indicator rectangle (QRect) |
|
272 </dd> |
|
273 </dl> |
|
274 <a NAME="EricMapWidget.isEnabled" ID="EricMapWidget.isEnabled"></a> |
|
275 <h4>EricMapWidget.isEnabled</h4> |
|
276 <b>isEnabled</b>(<i></i>) |
|
277 |
|
278 <p> |
|
279 Public method to check the enabled state. |
|
280 </p> |
|
281 <dl> |
|
282 <dt>Return:</dt> |
|
283 <dd> |
|
284 flag indicating the enabled state (boolean) |
|
285 </dd> |
|
286 </dl> |
|
287 <a NAME="EricMapWidget.isOnRightSide" ID="EricMapWidget.isOnRightSide"></a> |
|
288 <h4>EricMapWidget.isOnRightSide</h4> |
|
289 <b>isOnRightSide</b>(<i></i>) |
|
290 |
|
291 <p> |
|
292 Public method to test, if the map is shown on the right side of the |
|
293 master widget. |
|
294 </p> |
|
295 <dl> |
|
296 <dt>Return:</dt> |
|
297 <dd> |
|
298 flag indicating that the map is to the right of the master |
|
299 widget |
|
300 </dd> |
|
301 </dl> |
|
302 <dl> |
|
303 <dt>Return Type:</dt> |
|
304 <dd> |
|
305 bool |
|
306 </dd> |
|
307 </dl> |
|
308 <a NAME="EricMapWidget.lineDimensions" ID="EricMapWidget.lineDimensions"></a> |
|
309 <h4>EricMapWidget.lineDimensions</h4> |
|
310 <b>lineDimensions</b>(<i></i>) |
|
311 |
|
312 <p> |
|
313 Public method to get the line (indicator) dimensions. |
|
314 </p> |
|
315 <dl> |
|
316 <dt>Return:</dt> |
|
317 <dd> |
|
318 tuple with border width (integer) and line height (integer) |
|
319 </dd> |
|
320 </dl> |
|
321 <a NAME="EricMapWidget.mouseMoveEvent" ID="EricMapWidget.mouseMoveEvent"></a> |
|
322 <h4>EricMapWidget.mouseMoveEvent</h4> |
|
323 <b>mouseMoveEvent</b>(<i>event</i>) |
|
324 |
|
325 <p> |
|
326 Protected method to handle a mouse moves. |
|
327 </p> |
|
328 <dl> |
|
329 |
|
330 <dt><i>event</i></dt> |
|
331 <dd> |
|
332 reference to the mouse event (QMouseEvent) |
|
333 </dd> |
|
334 </dl> |
|
335 <a NAME="EricMapWidget.mousePressEvent" ID="EricMapWidget.mousePressEvent"></a> |
|
336 <h4>EricMapWidget.mousePressEvent</h4> |
|
337 <b>mousePressEvent</b>(<i>event</i>) |
|
338 |
|
339 <p> |
|
340 Protected method to handle a mouse button press. |
|
341 </p> |
|
342 <dl> |
|
343 |
|
344 <dt><i>event</i></dt> |
|
345 <dd> |
|
346 reference to the mouse event (QMouseEvent) |
|
347 </dd> |
|
348 </dl> |
|
349 <a NAME="EricMapWidget.paintEvent" ID="EricMapWidget.paintEvent"></a> |
|
350 <h4>EricMapWidget.paintEvent</h4> |
|
351 <b>paintEvent</b>(<i>event</i>) |
|
352 |
|
353 <p> |
|
354 Protected method to handle a paint event. |
|
355 </p> |
|
356 <dl> |
|
357 |
|
358 <dt><i>event</i></dt> |
|
359 <dd> |
|
360 paint event (QPaintEvent) |
|
361 </dd> |
|
362 </dl> |
|
363 <a NAME="EricMapWidget.position2Value" ID="EricMapWidget.position2Value"></a> |
|
364 <h4>EricMapWidget.position2Value</h4> |
|
365 <b>position2Value</b>(<i>position, slider=False</i>) |
|
366 |
|
367 <p> |
|
368 Public method to convert a position into a scrollbar value. |
|
369 </p> |
|
370 <dl> |
|
371 |
|
372 <dt><i>position</i></dt> |
|
373 <dd> |
|
374 scrollbar position to convert (integer) |
|
375 </dd> |
|
376 <dt><i>slider</i></dt> |
|
377 <dd> |
|
378 flag indicating to calculate the result for the slider |
|
379 (boolean) |
|
380 </dd> |
|
381 </dl> |
|
382 <dl> |
|
383 <dt>Return:</dt> |
|
384 <dd> |
|
385 scrollbar value (integer) |
|
386 </dd> |
|
387 </dl> |
|
388 <a NAME="EricMapWidget.scaleFactor" ID="EricMapWidget.scaleFactor"></a> |
|
389 <h4>EricMapWidget.scaleFactor</h4> |
|
390 <b>scaleFactor</b>(<i>slider=False</i>) |
|
391 |
|
392 <p> |
|
393 Public method to determine the scrollbar's scale factor. |
|
394 </p> |
|
395 <dl> |
|
396 |
|
397 <dt><i>slider</i></dt> |
|
398 <dd> |
|
399 flag indicating to calculate the result for the slider |
|
400 (boolean) |
|
401 </dd> |
|
402 </dl> |
|
403 <dl> |
|
404 <dt>Return:</dt> |
|
405 <dd> |
|
406 scale factor (float) |
|
407 </dd> |
|
408 </dl> |
|
409 <a NAME="EricMapWidget.setBackgroundColor" ID="EricMapWidget.setBackgroundColor"></a> |
|
410 <h4>EricMapWidget.setBackgroundColor</h4> |
|
411 <b>setBackgroundColor</b>(<i>color</i>) |
|
412 |
|
413 <p> |
|
414 Public method to set the widget background color. |
|
415 </p> |
|
416 <dl> |
|
417 |
|
418 <dt><i>color</i></dt> |
|
419 <dd> |
|
420 color for the background (QColor) |
|
421 </dd> |
|
422 </dl> |
|
423 <a NAME="EricMapWidget.setEnabled" ID="EricMapWidget.setEnabled"></a> |
|
424 <h4>EricMapWidget.setEnabled</h4> |
|
425 <b>setEnabled</b>(<i>enable</i>) |
|
426 |
|
427 <p> |
|
428 Public method to set the enabled state. |
|
429 </p> |
|
430 <dl> |
|
431 |
|
432 <dt><i>enable</i></dt> |
|
433 <dd> |
|
434 flag indicating the enabled state (boolean) |
|
435 </dd> |
|
436 </dl> |
|
437 <a NAME="EricMapWidget.setLineDimensions" ID="EricMapWidget.setLineDimensions"></a> |
|
438 <h4>EricMapWidget.setLineDimensions</h4> |
|
439 <b>setLineDimensions</b>(<i>border, height</i>) |
|
440 |
|
441 <p> |
|
442 Public method to set the line (indicator) dimensions. |
|
443 </p> |
|
444 <dl> |
|
445 |
|
446 <dt><i>border</i></dt> |
|
447 <dd> |
|
448 border width on each side in x-direction (integer) |
|
449 </dd> |
|
450 <dt><i>height</i></dt> |
|
451 <dd> |
|
452 height of the line in pixels (integer) |
|
453 </dd> |
|
454 </dl> |
|
455 <a NAME="EricMapWidget.setMapPosition" ID="EricMapWidget.setMapPosition"></a> |
|
456 <h4>EricMapWidget.setMapPosition</h4> |
|
457 <b>setMapPosition</b>(<i>onRight</i>) |
|
458 |
|
459 <p> |
|
460 Public method to set, whether the map should be shown to the right or |
|
461 left of the master widget. |
|
462 </p> |
|
463 <dl> |
|
464 |
|
465 <dt><i>onRight</i> (bool)</dt> |
|
466 <dd> |
|
467 flag indicating to show the map on the right side of |
|
468 the master widget |
|
469 </dd> |
|
470 </dl> |
|
471 <a NAME="EricMapWidget.setMaster" ID="EricMapWidget.setMaster"></a> |
|
472 <h4>EricMapWidget.setMaster</h4> |
|
473 <b>setMaster</b>(<i>master</i>) |
|
474 |
|
475 <p> |
|
476 Public method to set the map master widget. |
|
477 </p> |
|
478 <dl> |
|
479 |
|
480 <dt><i>master</i></dt> |
|
481 <dd> |
|
482 map master widget (QAbstractScrollArea) |
|
483 </dd> |
|
484 </dl> |
|
485 <a NAME="EricMapWidget.setWidth" ID="EricMapWidget.setWidth"></a> |
|
486 <h4>EricMapWidget.setWidth</h4> |
|
487 <b>setWidth</b>(<i>width</i>) |
|
488 |
|
489 <p> |
|
490 Public method to set the widget width. |
|
491 </p> |
|
492 <dl> |
|
493 |
|
494 <dt><i>width</i></dt> |
|
495 <dd> |
|
496 widget width (integer) |
|
497 </dd> |
|
498 </dl> |
|
499 <a NAME="EricMapWidget.sizeHint" ID="EricMapWidget.sizeHint"></a> |
|
500 <h4>EricMapWidget.sizeHint</h4> |
|
501 <b>sizeHint</b>(<i></i>) |
|
502 |
|
503 <p> |
|
504 Public method to give an indication about the preferred size. |
|
505 </p> |
|
506 <dl> |
|
507 <dt>Return:</dt> |
|
508 <dd> |
|
509 preferred size (QSize) |
|
510 </dd> |
|
511 </dl> |
|
512 <a NAME="EricMapWidget.value2Position" ID="EricMapWidget.value2Position"></a> |
|
513 <h4>EricMapWidget.value2Position</h4> |
|
514 <b>value2Position</b>(<i>value, slider=False</i>) |
|
515 |
|
516 <p> |
|
517 Public method to convert a scrollbar value into a position. |
|
518 </p> |
|
519 <dl> |
|
520 |
|
521 <dt><i>value</i></dt> |
|
522 <dd> |
|
523 value to convert (integer) |
|
524 </dd> |
|
525 <dt><i>slider</i></dt> |
|
526 <dd> |
|
527 flag indicating to calculate the result for the slider |
|
528 (boolean) |
|
529 </dd> |
|
530 </dl> |
|
531 <dl> |
|
532 <dt>Return:</dt> |
|
533 <dd> |
|
534 position (integer) |
|
535 </dd> |
|
536 </dl> |
|
537 <a NAME="EricMapWidget.wheelEvent" ID="EricMapWidget.wheelEvent"></a> |
|
538 <h4>EricMapWidget.wheelEvent</h4> |
|
539 <b>wheelEvent</b>(<i>event</i>) |
|
540 |
|
541 <p> |
|
542 Protected slot handling mouse wheel events. |
|
543 </p> |
|
544 <dl> |
|
545 |
|
546 <dt><i>event</i></dt> |
|
547 <dd> |
|
548 reference to the wheel event (QWheelEvent) |
|
549 </dd> |
|
550 </dl> |
|
551 <a NAME="EricMapWidget.width" ID="EricMapWidget.width"></a> |
|
552 <h4>EricMapWidget.width</h4> |
|
553 <b>width</b>(<i></i>) |
|
554 |
|
555 <p> |
|
556 Public method to get the widget's width. |
|
557 </p> |
|
558 <dl> |
|
559 <dt>Return:</dt> |
|
560 <dd> |
|
561 widget width (integer) |
|
562 </dd> |
|
563 </dl> |
|
564 <div align="right"><a href="#top">Up</a></div> |
|
565 <hr /> |
|
566 </body></html> |