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