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

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

eric ide

mercurial