src/eric7/Documentation/Source/eric7.EricWidgets.EricModelMenu.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 10423
299802979277
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.EricWidgets.EricModelMenu</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.EricModelMenu</h1>
10
11 <p>
12 Module implementing a menu populated from a QAbstractItemModel.
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="#EricModelMenu">EricModelMenu</a></td>
25 <td>Class implementing a menu populated from a QAbstractItemModel.</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="EricModelMenu" ID="EricModelMenu"></a>
36 <h2>EricModelMenu</h2>
37
38 <p>
39 Class implementing a menu populated from a QAbstractItemModel.
40 </p>
41 <h3>Signals</h3>
42 <dl>
43
44 <dt>activated(QModelIndex)</dt>
45 <dd>
46 emitted when an action has been triggered
47 </dd>
48 </dl>
49 <h3>Derived from</h3>
50 QMenu
51 <h3>Class Attributes</h3>
52
53 <table>
54 <tr><td>None</td></tr>
55 </table>
56 <h3>Class Methods</h3>
57
58 <table>
59 <tr><td>None</td></tr>
60 </table>
61 <h3>Methods</h3>
62
63 <table>
64
65 <tr>
66 <td><a href="#EricModelMenu.__init__">EricModelMenu</a></td>
67 <td>Constructor</td>
68 </tr>
69 <tr>
70 <td><a href="#EricModelMenu.__aboutToShow">__aboutToShow</a></td>
71 <td>Private slot to show the menu.</td>
72 </tr>
73 <tr>
74 <td><a href="#EricModelMenu.__actionTriggered">__actionTriggered</a></td>
75 <td>Private slot to handle the triggering of an action.</td>
76 </tr>
77 <tr>
78 <td><a href="#EricModelMenu.__makeAction">__makeAction</a></td>
79 <td>Private method to create an action.</td>
80 </tr>
81 <tr>
82 <td><a href="#EricModelMenu.clear">clear</a></td>
83 <td>Public method to clear the menu.</td>
84 </tr>
85 <tr>
86 <td><a href="#EricModelMenu.createBaseMenu">createBaseMenu</a></td>
87 <td>Public method to get the menu that is used to populate sub menu's.</td>
88 </tr>
89 <tr>
90 <td><a href="#EricModelMenu.createMenu">createMenu</a></td>
91 <td>Public method to put all the children of a parent into a menu of a given length.</td>
92 </tr>
93 <tr>
94 <td><a href="#EricModelMenu.dragEnterEvent">dragEnterEvent</a></td>
95 <td>Protected method to handle drag enter events.</td>
96 </tr>
97 <tr>
98 <td><a href="#EricModelMenu.dropEvent">dropEvent</a></td>
99 <td>Protected method to handle drop events.</td>
100 </tr>
101 <tr>
102 <td><a href="#EricModelMenu.firstSeparator">firstSeparator</a></td>
103 <td>Public method to get the first separator.</td>
104 </tr>
105 <tr>
106 <td><a href="#EricModelMenu.index">index</a></td>
107 <td>Public method to get the index of an action.</td>
108 </tr>
109 <tr>
110 <td><a href="#EricModelMenu.makeAction">makeAction</a></td>
111 <td>Public method to create an action.</td>
112 </tr>
113 <tr>
114 <td><a href="#EricModelMenu.maxRows">maxRows</a></td>
115 <td>Public method to get the maximum number of entries to show.</td>
116 </tr>
117 <tr>
118 <td><a href="#EricModelMenu.model">model</a></td>
119 <td>Public method to get a reference to the model.</td>
120 </tr>
121 <tr>
122 <td><a href="#EricModelMenu.mouseMoveEvent">mouseMoveEvent</a></td>
123 <td>Protected method to handle mouse move events.</td>
124 </tr>
125 <tr>
126 <td><a href="#EricModelMenu.mousePressEvent">mousePressEvent</a></td>
127 <td>Protected method handling mouse press events.</td>
128 </tr>
129 <tr>
130 <td><a href="#EricModelMenu.mouseReleaseEvent">mouseReleaseEvent</a></td>
131 <td>Protected method handling mouse release events.</td>
132 </tr>
133 <tr>
134 <td><a href="#EricModelMenu.postPopulated">postPopulated</a></td>
135 <td>Public method to add any actions after the tree.</td>
136 </tr>
137 <tr>
138 <td><a href="#EricModelMenu.prePopulated">prePopulated</a></td>
139 <td>Public method to add any actions before the tree.</td>
140 </tr>
141 <tr>
142 <td><a href="#EricModelMenu.removeEntry">removeEntry</a></td>
143 <td>Public method to remove a menu entry.</td>
144 </tr>
145 <tr>
146 <td><a href="#EricModelMenu.resetFlags">resetFlags</a></td>
147 <td>Public method to reset the saved internal state.</td>
148 </tr>
149 <tr>
150 <td><a href="#EricModelMenu.rootIndex">rootIndex</a></td>
151 <td>Public method to get the index of the root item.</td>
152 </tr>
153 <tr>
154 <td><a href="#EricModelMenu.separatorRole">separatorRole</a></td>
155 <td>Public method to get the role of the separator.</td>
156 </tr>
157 <tr>
158 <td><a href="#EricModelMenu.setFirstSeparator">setFirstSeparator</a></td>
159 <td>Public method to set the first separator.</td>
160 </tr>
161 <tr>
162 <td><a href="#EricModelMenu.setMaxRows">setMaxRows</a></td>
163 <td>Public method to set the maximum number of entries to show.</td>
164 </tr>
165 <tr>
166 <td><a href="#EricModelMenu.setModel">setModel</a></td>
167 <td>Public method to set the model for the menu.</td>
168 </tr>
169 <tr>
170 <td><a href="#EricModelMenu.setRootIndex">setRootIndex</a></td>
171 <td>Public method to set the index of the root item.</td>
172 </tr>
173 <tr>
174 <td><a href="#EricModelMenu.setSeparatorRole">setSeparatorRole</a></td>
175 <td>Public method to set the role of the separator.</td>
176 </tr>
177 <tr>
178 <td><a href="#EricModelMenu.setStatusBarTextRole">setStatusBarTextRole</a></td>
179 <td>Public method to set the role of the status bar text.</td>
180 </tr>
181 <tr>
182 <td><a href="#EricModelMenu.statusBarTextRole">statusBarTextRole</a></td>
183 <td>Public method to get the role of the status bar text.</td>
184 </tr>
185 </table>
186 <h3>Static Methods</h3>
187
188 <table>
189 <tr><td>None</td></tr>
190 </table>
191
192 <a NAME="EricModelMenu.__init__" ID="EricModelMenu.__init__"></a>
193 <h4>EricModelMenu (Constructor)</h4>
194 <b>EricModelMenu</b>(<i>parent=None</i>)
195
196 <p>
197 Constructor
198 </p>
199 <dl>
200
201 <dt><i>parent</i></dt>
202 <dd>
203 reference to the parent widget (QWidget)
204 </dd>
205 </dl>
206 <a NAME="EricModelMenu.__aboutToShow" ID="EricModelMenu.__aboutToShow"></a>
207 <h4>EricModelMenu.__aboutToShow</h4>
208 <b>__aboutToShow</b>(<i></i>)
209
210 <p>
211 Private slot to show the menu.
212 </p>
213 <a NAME="EricModelMenu.__actionTriggered" ID="EricModelMenu.__actionTriggered"></a>
214 <h4>EricModelMenu.__actionTriggered</h4>
215 <b>__actionTriggered</b>(<i>action</i>)
216
217 <p>
218 Private slot to handle the triggering of an action.
219 </p>
220 <dl>
221
222 <dt><i>action</i></dt>
223 <dd>
224 reference to the action that was triggered (QAction)
225 </dd>
226 </dl>
227 <a NAME="EricModelMenu.__makeAction" ID="EricModelMenu.__makeAction"></a>
228 <h4>EricModelMenu.__makeAction</h4>
229 <b>__makeAction</b>(<i>idx</i>)
230
231 <p>
232 Private method to create an action.
233 </p>
234 <dl>
235
236 <dt><i>idx</i></dt>
237 <dd>
238 index of the item to create an action for (QModelIndex)
239 </dd>
240 </dl>
241 <dl>
242 <dt>Return:</dt>
243 <dd>
244 reference to the created action (QAction)
245 </dd>
246 </dl>
247 <a NAME="EricModelMenu.clear" ID="EricModelMenu.clear"></a>
248 <h4>EricModelMenu.clear</h4>
249 <b>clear</b>(<i></i>)
250
251 <p>
252 Public method to clear the menu.
253 </p>
254 <a NAME="EricModelMenu.createBaseMenu" ID="EricModelMenu.createBaseMenu"></a>
255 <h4>EricModelMenu.createBaseMenu</h4>
256 <b>createBaseMenu</b>(<i></i>)
257
258 <p>
259 Public method to get the menu that is used to populate sub menu's.
260 </p>
261 <dl>
262 <dt>Return:</dt>
263 <dd>
264 reference to the menu (EricModelMenu)
265 </dd>
266 </dl>
267 <a NAME="EricModelMenu.createMenu" ID="EricModelMenu.createMenu"></a>
268 <h4>EricModelMenu.createMenu</h4>
269 <b>createMenu</b>(<i>parent, max_, parentMenu=None, menu=None</i>)
270
271 <p>
272 Public method to put all the children of a parent into a menu of a
273 given length.
274 </p>
275 <dl>
276
277 <dt><i>parent</i></dt>
278 <dd>
279 index of the parent item (QModelIndex)
280 </dd>
281 <dt><i>max_</i></dt>
282 <dd>
283 maximum number of entries (integer)
284 </dd>
285 <dt><i>parentMenu</i></dt>
286 <dd>
287 reference to the parent menu (QMenu)
288 </dd>
289 <dt><i>menu</i></dt>
290 <dd>
291 reference to the menu to be populated (QMenu)
292 </dd>
293 </dl>
294 <a NAME="EricModelMenu.dragEnterEvent" ID="EricModelMenu.dragEnterEvent"></a>
295 <h4>EricModelMenu.dragEnterEvent</h4>
296 <b>dragEnterEvent</b>(<i>evt</i>)
297
298 <p>
299 Protected method to handle drag enter events.
300 </p>
301 <dl>
302
303 <dt><i>evt</i></dt>
304 <dd>
305 reference to the event (QDragEnterEvent)
306 </dd>
307 </dl>
308 <a NAME="EricModelMenu.dropEvent" ID="EricModelMenu.dropEvent"></a>
309 <h4>EricModelMenu.dropEvent</h4>
310 <b>dropEvent</b>(<i>evt</i>)
311
312 <p>
313 Protected method to handle drop events.
314 </p>
315 <dl>
316
317 <dt><i>evt</i></dt>
318 <dd>
319 reference to the event (QDropEvent)
320 </dd>
321 </dl>
322 <a NAME="EricModelMenu.firstSeparator" ID="EricModelMenu.firstSeparator"></a>
323 <h4>EricModelMenu.firstSeparator</h4>
324 <b>firstSeparator</b>(<i></i>)
325
326 <p>
327 Public method to get the first separator.
328 </p>
329 <dl>
330 <dt>Return:</dt>
331 <dd>
332 row number of the first separator (integer)
333 </dd>
334 </dl>
335 <a NAME="EricModelMenu.index" ID="EricModelMenu.index"></a>
336 <h4>EricModelMenu.index</h4>
337 <b>index</b>(<i>action</i>)
338
339 <p>
340 Public method to get the index of an action.
341 </p>
342 <dl>
343
344 <dt><i>action</i></dt>
345 <dd>
346 reference to the action to get the index for (QAction)
347 </dd>
348 </dl>
349 <dl>
350 <dt>Return:</dt>
351 <dd>
352 index of the action (QModelIndex)
353 </dd>
354 </dl>
355 <a NAME="EricModelMenu.makeAction" ID="EricModelMenu.makeAction"></a>
356 <h4>EricModelMenu.makeAction</h4>
357 <b>makeAction</b>(<i>icon, text, parent</i>)
358
359 <p>
360 Public method to create an action.
361 </p>
362 <dl>
363
364 <dt><i>icon</i></dt>
365 <dd>
366 icon of the action (QIcon)
367 </dd>
368 <dt><i>text</i></dt>
369 <dd>
370 text of the action (string)
371 </dd>
372 <dt><i>parent</i></dt>
373 <dd>
374 reference to the parent object (QObject)
375 </dd>
376 </dl>
377 <dl>
378 <dt>Return:</dt>
379 <dd>
380 reference to the created action (QAction)
381 </dd>
382 </dl>
383 <a NAME="EricModelMenu.maxRows" ID="EricModelMenu.maxRows"></a>
384 <h4>EricModelMenu.maxRows</h4>
385 <b>maxRows</b>(<i></i>)
386
387 <p>
388 Public method to get the maximum number of entries to show.
389 </p>
390 <dl>
391 <dt>Return:</dt>
392 <dd>
393 maximum number of entries to show (integer)
394 </dd>
395 </dl>
396 <a NAME="EricModelMenu.model" ID="EricModelMenu.model"></a>
397 <h4>EricModelMenu.model</h4>
398 <b>model</b>(<i></i>)
399
400 <p>
401 Public method to get a reference to the model.
402 </p>
403 <dl>
404 <dt>Return:</dt>
405 <dd>
406 reference to the model (QAbstractItemModel)
407 </dd>
408 </dl>
409 <a NAME="EricModelMenu.mouseMoveEvent" ID="EricModelMenu.mouseMoveEvent"></a>
410 <h4>EricModelMenu.mouseMoveEvent</h4>
411 <b>mouseMoveEvent</b>(<i>evt</i>)
412
413 <p>
414 Protected method to handle mouse move events.
415 </p>
416 <dl>
417
418 <dt><i>evt</i></dt>
419 <dd>
420 reference to the event (QMouseEvent)
421 </dd>
422 </dl>
423 <a NAME="EricModelMenu.mousePressEvent" ID="EricModelMenu.mousePressEvent"></a>
424 <h4>EricModelMenu.mousePressEvent</h4>
425 <b>mousePressEvent</b>(<i>evt</i>)
426
427 <p>
428 Protected method handling mouse press events.
429 </p>
430 <dl>
431
432 <dt><i>evt</i></dt>
433 <dd>
434 reference to the event object (QMouseEvent)
435 </dd>
436 </dl>
437 <a NAME="EricModelMenu.mouseReleaseEvent" ID="EricModelMenu.mouseReleaseEvent"></a>
438 <h4>EricModelMenu.mouseReleaseEvent</h4>
439 <b>mouseReleaseEvent</b>(<i>evt</i>)
440
441 <p>
442 Protected method handling mouse release events.
443 </p>
444 <dl>
445
446 <dt><i>evt</i></dt>
447 <dd>
448 reference to the event object (QMouseEvent)
449 </dd>
450 </dl>
451 <a NAME="EricModelMenu.postPopulated" ID="EricModelMenu.postPopulated"></a>
452 <h4>EricModelMenu.postPopulated</h4>
453 <b>postPopulated</b>(<i></i>)
454
455 <p>
456 Public method to add any actions after the tree.
457 </p>
458 <a NAME="EricModelMenu.prePopulated" ID="EricModelMenu.prePopulated"></a>
459 <h4>EricModelMenu.prePopulated</h4>
460 <b>prePopulated</b>(<i></i>)
461
462 <p>
463 Public method to add any actions before the tree.
464 </p>
465 <dl>
466 <dt>Return:</dt>
467 <dd>
468 flag indicating if any actions were added
469 </dd>
470 </dl>
471 <a NAME="EricModelMenu.removeEntry" ID="EricModelMenu.removeEntry"></a>
472 <h4>EricModelMenu.removeEntry</h4>
473 <b>removeEntry</b>(<i>idx</i>)
474
475 <p>
476 Public method to remove a menu entry.
477 </p>
478 <dl>
479
480 <dt><i>idx</i></dt>
481 <dd>
482 index of the entry to be removed (QModelIndex)
483 </dd>
484 </dl>
485 <a NAME="EricModelMenu.resetFlags" ID="EricModelMenu.resetFlags"></a>
486 <h4>EricModelMenu.resetFlags</h4>
487 <b>resetFlags</b>(<i></i>)
488
489 <p>
490 Public method to reset the saved internal state.
491 </p>
492 <a NAME="EricModelMenu.rootIndex" ID="EricModelMenu.rootIndex"></a>
493 <h4>EricModelMenu.rootIndex</h4>
494 <b>rootIndex</b>(<i></i>)
495
496 <p>
497 Public method to get the index of the root item.
498 </p>
499 <dl>
500 <dt>Return:</dt>
501 <dd>
502 index of the root item (QModelIndex)
503 </dd>
504 </dl>
505 <a NAME="EricModelMenu.separatorRole" ID="EricModelMenu.separatorRole"></a>
506 <h4>EricModelMenu.separatorRole</h4>
507 <b>separatorRole</b>(<i></i>)
508
509 <p>
510 Public method to get the role of the separator.
511 </p>
512 <dl>
513 <dt>Return:</dt>
514 <dd>
515 role of the separator (integer)
516 </dd>
517 </dl>
518 <a NAME="EricModelMenu.setFirstSeparator" ID="EricModelMenu.setFirstSeparator"></a>
519 <h4>EricModelMenu.setFirstSeparator</h4>
520 <b>setFirstSeparator</b>(<i>offset</i>)
521
522 <p>
523 Public method to set the first separator.
524 </p>
525 <dl>
526
527 <dt><i>offset</i></dt>
528 <dd>
529 row number of the first separator (integer)
530 </dd>
531 </dl>
532 <a NAME="EricModelMenu.setMaxRows" ID="EricModelMenu.setMaxRows"></a>
533 <h4>EricModelMenu.setMaxRows</h4>
534 <b>setMaxRows</b>(<i>rows</i>)
535
536 <p>
537 Public method to set the maximum number of entries to show.
538 </p>
539 <dl>
540
541 <dt><i>rows</i></dt>
542 <dd>
543 maximum number of entries to show (integer)
544 </dd>
545 </dl>
546 <a NAME="EricModelMenu.setModel" ID="EricModelMenu.setModel"></a>
547 <h4>EricModelMenu.setModel</h4>
548 <b>setModel</b>(<i>model</i>)
549
550 <p>
551 Public method to set the model for the menu.
552 </p>
553 <dl>
554
555 <dt><i>model</i></dt>
556 <dd>
557 reference to the model (QAbstractItemModel)
558 </dd>
559 </dl>
560 <a NAME="EricModelMenu.setRootIndex" ID="EricModelMenu.setRootIndex"></a>
561 <h4>EricModelMenu.setRootIndex</h4>
562 <b>setRootIndex</b>(<i>index</i>)
563
564 <p>
565 Public method to set the index of the root item.
566 </p>
567 <dl>
568
569 <dt><i>index</i></dt>
570 <dd>
571 index of the root item (QModelIndex)
572 </dd>
573 </dl>
574 <a NAME="EricModelMenu.setSeparatorRole" ID="EricModelMenu.setSeparatorRole"></a>
575 <h4>EricModelMenu.setSeparatorRole</h4>
576 <b>setSeparatorRole</b>(<i>role</i>)
577
578 <p>
579 Public method to set the role of the separator.
580 </p>
581 <dl>
582
583 <dt><i>role</i></dt>
584 <dd>
585 role of the separator (integer)
586 </dd>
587 </dl>
588 <a NAME="EricModelMenu.setStatusBarTextRole" ID="EricModelMenu.setStatusBarTextRole"></a>
589 <h4>EricModelMenu.setStatusBarTextRole</h4>
590 <b>setStatusBarTextRole</b>(<i>role</i>)
591
592 <p>
593 Public method to set the role of the status bar text.
594 </p>
595 <dl>
596
597 <dt><i>role</i></dt>
598 <dd>
599 role of the status bar text (integer)
600 </dd>
601 </dl>
602 <a NAME="EricModelMenu.statusBarTextRole" ID="EricModelMenu.statusBarTextRole"></a>
603 <h4>EricModelMenu.statusBarTextRole</h4>
604 <b>statusBarTextRole</b>(<i></i>)
605
606 <p>
607 Public method to get the role of the status bar text.
608 </p>
609 <dl>
610 <dt>Return:</dt>
611 <dd>
612 role of the status bar text (integer)
613 </dd>
614 </dl>
615 <div align="right"><a href="#top">Up</a></div>
616 <hr />
617 </body></html>

eric ide

mercurial