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