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