eric6/Documentation/Source/eric6.E5Gui.E5ModelMenu.html

branch
maintenance
changeset 6989
8b8cadf8d7e9
parent 6942
2602857055c5
child 7273
391d6b7b1eff
equal deleted inserted replaced
6938:7926553b7509 6989:8b8cadf8d7e9
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.E5Gui.E5ModelMenu</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.E5ModelMenu</h1>
23 <p>
24 Module implementing a menu populated from a QAbstractItemModel.
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="#E5ModelMenu">E5ModelMenu</a></td>
34 <td>Class implementing a menu populated from a QAbstractItemModel.</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="E5ModelMenu" ID="E5ModelMenu"></a>
43 <h2>E5ModelMenu</h2>
44 <p>
45 Class implementing a menu populated from a QAbstractItemModel.
46 </p><h3>Signals</h3>
47 <dl>
48 <dt>activated(QModelIndex)</dt>
49 <dd>
50 emitted when an action has been triggered
51 </dd>
52 </dl>
53 <h3>Derived from</h3>
54 QMenu
55 <h3>Class Attributes</h3>
56 <table>
57 <tr><td>None</td></tr>
58 </table>
59 <h3>Class Methods</h3>
60 <table>
61 <tr><td>None</td></tr>
62 </table>
63 <h3>Methods</h3>
64 <table>
65 <tr>
66 <td><a href="#E5ModelMenu.__init__">E5ModelMenu</a></td>
67 <td>Constructor</td>
68 </tr><tr>
69 <td><a href="#E5ModelMenu.__aboutToShow">__aboutToShow</a></td>
70 <td>Private slot to show the menu.</td>
71 </tr><tr>
72 <td><a href="#E5ModelMenu.__actionTriggered">__actionTriggered</a></td>
73 <td>Private slot to handle the triggering of an action.</td>
74 </tr><tr>
75 <td><a href="#E5ModelMenu.__makeAction">__makeAction</a></td>
76 <td>Private method to create an action.</td>
77 </tr><tr>
78 <td><a href="#E5ModelMenu.createBaseMenu">createBaseMenu</a></td>
79 <td>Public method to get the menu that is used to populate sub menu's.</td>
80 </tr><tr>
81 <td><a href="#E5ModelMenu.createMenu">createMenu</a></td>
82 <td>Public method to put all the children of a parent into a menu of a given length.</td>
83 </tr><tr>
84 <td><a href="#E5ModelMenu.dragEnterEvent">dragEnterEvent</a></td>
85 <td>Protected method to handle drag enter events.</td>
86 </tr><tr>
87 <td><a href="#E5ModelMenu.dropEvent">dropEvent</a></td>
88 <td>Protected method to handle drop events.</td>
89 </tr><tr>
90 <td><a href="#E5ModelMenu.firstSeparator">firstSeparator</a></td>
91 <td>Public method to get the first separator.</td>
92 </tr><tr>
93 <td><a href="#E5ModelMenu.index">index</a></td>
94 <td>Public method to get the index of an action.</td>
95 </tr><tr>
96 <td><a href="#E5ModelMenu.makeAction">makeAction</a></td>
97 <td>Public method to create an action.</td>
98 </tr><tr>
99 <td><a href="#E5ModelMenu.maxRows">maxRows</a></td>
100 <td>Public method to get the maximum number of entries to show.</td>
101 </tr><tr>
102 <td><a href="#E5ModelMenu.model">model</a></td>
103 <td>Public method to get a reference to the model.</td>
104 </tr><tr>
105 <td><a href="#E5ModelMenu.mouseMoveEvent">mouseMoveEvent</a></td>
106 <td>Protected method to handle mouse move events.</td>
107 </tr><tr>
108 <td><a href="#E5ModelMenu.mousePressEvent">mousePressEvent</a></td>
109 <td>Protected method handling mouse press events.</td>
110 </tr><tr>
111 <td><a href="#E5ModelMenu.mouseReleaseEvent">mouseReleaseEvent</a></td>
112 <td>Protected method handling mouse release events.</td>
113 </tr><tr>
114 <td><a href="#E5ModelMenu.postPopulated">postPopulated</a></td>
115 <td>Public method to add any actions after the tree.</td>
116 </tr><tr>
117 <td><a href="#E5ModelMenu.prePopulated">prePopulated</a></td>
118 <td>Public method to add any actions before the tree.</td>
119 </tr><tr>
120 <td><a href="#E5ModelMenu.removeEntry">removeEntry</a></td>
121 <td>Public method to remove a menu entry.</td>
122 </tr><tr>
123 <td><a href="#E5ModelMenu.resetFlags">resetFlags</a></td>
124 <td>Public method to reset the saved internal state.</td>
125 </tr><tr>
126 <td><a href="#E5ModelMenu.rootIndex">rootIndex</a></td>
127 <td>Public method to get the index of the root item.</td>
128 </tr><tr>
129 <td><a href="#E5ModelMenu.separatorRole">separatorRole</a></td>
130 <td>Public method to get the role of the separator.</td>
131 </tr><tr>
132 <td><a href="#E5ModelMenu.setFirstSeparator">setFirstSeparator</a></td>
133 <td>Public method to set the first separator.</td>
134 </tr><tr>
135 <td><a href="#E5ModelMenu.setMaxRows">setMaxRows</a></td>
136 <td>Public method to set the maximum number of entries to show.</td>
137 </tr><tr>
138 <td><a href="#E5ModelMenu.setModel">setModel</a></td>
139 <td>Public method to set the model for the menu.</td>
140 </tr><tr>
141 <td><a href="#E5ModelMenu.setRootIndex">setRootIndex</a></td>
142 <td>Public method to set the index of the root item.</td>
143 </tr><tr>
144 <td><a href="#E5ModelMenu.setSeparatorRole">setSeparatorRole</a></td>
145 <td>Public method to set the role of the separator.</td>
146 </tr><tr>
147 <td><a href="#E5ModelMenu.setStatusBarTextRole">setStatusBarTextRole</a></td>
148 <td>Public method to set the role of the status bar text.</td>
149 </tr><tr>
150 <td><a href="#E5ModelMenu.statusBarTextRole">statusBarTextRole</a></td>
151 <td>Public method to get the role of the status bar text.</td>
152 </tr>
153 </table>
154 <h3>Static Methods</h3>
155 <table>
156 <tr><td>None</td></tr>
157 </table>
158 <a NAME="E5ModelMenu.__init__" ID="E5ModelMenu.__init__"></a>
159 <h4>E5ModelMenu (Constructor)</h4>
160 <b>E5ModelMenu</b>(<i>parent=None</i>)
161 <p>
162 Constructor
163 </p><dl>
164 <dt><i>parent</i></dt>
165 <dd>
166 reference to the parent widget (QWidget)
167 </dd>
168 </dl><a NAME="E5ModelMenu.__aboutToShow" ID="E5ModelMenu.__aboutToShow"></a>
169 <h4>E5ModelMenu.__aboutToShow</h4>
170 <b>__aboutToShow</b>(<i></i>)
171 <p>
172 Private slot to show the menu.
173 </p><a NAME="E5ModelMenu.__actionTriggered" ID="E5ModelMenu.__actionTriggered"></a>
174 <h4>E5ModelMenu.__actionTriggered</h4>
175 <b>__actionTriggered</b>(<i>action</i>)
176 <p>
177 Private slot to handle the triggering of an action.
178 </p><dl>
179 <dt><i>action</i></dt>
180 <dd>
181 reference to the action that was triggered (QAction)
182 </dd>
183 </dl><a NAME="E5ModelMenu.__makeAction" ID="E5ModelMenu.__makeAction"></a>
184 <h4>E5ModelMenu.__makeAction</h4>
185 <b>__makeAction</b>(<i>idx</i>)
186 <p>
187 Private method to create an action.
188 </p><dl>
189 <dt><i>idx</i></dt>
190 <dd>
191 index of the item to create an action for (QModelIndex)
192 </dd>
193 </dl><dl>
194 <dt>Returns:</dt>
195 <dd>
196 reference to the created action (QAction)
197 </dd>
198 </dl><a NAME="E5ModelMenu.createBaseMenu" ID="E5ModelMenu.createBaseMenu"></a>
199 <h4>E5ModelMenu.createBaseMenu</h4>
200 <b>createBaseMenu</b>(<i></i>)
201 <p>
202 Public method to get the menu that is used to populate sub menu's.
203 </p><dl>
204 <dt>Returns:</dt>
205 <dd>
206 reference to the menu (E5ModelMenu)
207 </dd>
208 </dl><a NAME="E5ModelMenu.createMenu" ID="E5ModelMenu.createMenu"></a>
209 <h4>E5ModelMenu.createMenu</h4>
210 <b>createMenu</b>(<i>parent, max_, parentMenu=None, menu=None</i>)
211 <p>
212 Public method to put all the children of a parent into a menu of a
213 given length.
214 </p><dl>
215 <dt><i>parent</i></dt>
216 <dd>
217 index of the parent item (QModelIndex)
218 </dd><dt><i>max_</i></dt>
219 <dd>
220 maximum number of entries (integer)
221 </dd><dt><i>parentMenu</i></dt>
222 <dd>
223 reference to the parent menu (QMenu)
224 </dd><dt><i>menu</i></dt>
225 <dd>
226 reference to the menu to be populated (QMenu)
227 </dd>
228 </dl><a NAME="E5ModelMenu.dragEnterEvent" ID="E5ModelMenu.dragEnterEvent"></a>
229 <h4>E5ModelMenu.dragEnterEvent</h4>
230 <b>dragEnterEvent</b>(<i>evt</i>)
231 <p>
232 Protected method to handle drag enter events.
233 </p><dl>
234 <dt><i>evt</i></dt>
235 <dd>
236 reference to the event (QDragEnterEvent)
237 </dd>
238 </dl><a NAME="E5ModelMenu.dropEvent" ID="E5ModelMenu.dropEvent"></a>
239 <h4>E5ModelMenu.dropEvent</h4>
240 <b>dropEvent</b>(<i>evt</i>)
241 <p>
242 Protected method to handle drop events.
243 </p><dl>
244 <dt><i>evt</i></dt>
245 <dd>
246 reference to the event (QDropEvent)
247 </dd>
248 </dl><a NAME="E5ModelMenu.firstSeparator" ID="E5ModelMenu.firstSeparator"></a>
249 <h4>E5ModelMenu.firstSeparator</h4>
250 <b>firstSeparator</b>(<i></i>)
251 <p>
252 Public method to get the first separator.
253 </p><dl>
254 <dt>Returns:</dt>
255 <dd>
256 row number of the first separator (integer)
257 </dd>
258 </dl><a NAME="E5ModelMenu.index" ID="E5ModelMenu.index"></a>
259 <h4>E5ModelMenu.index</h4>
260 <b>index</b>(<i>action</i>)
261 <p>
262 Public method to get the index of an action.
263 </p><dl>
264 <dt><i>action</i></dt>
265 <dd>
266 reference to the action to get the index for (QAction)
267 </dd>
268 </dl><dl>
269 <dt>Returns:</dt>
270 <dd>
271 index of the action (QModelIndex)
272 </dd>
273 </dl><a NAME="E5ModelMenu.makeAction" ID="E5ModelMenu.makeAction"></a>
274 <h4>E5ModelMenu.makeAction</h4>
275 <b>makeAction</b>(<i>icon, text, parent</i>)
276 <p>
277 Public method to create an action.
278 </p><dl>
279 <dt><i>icon</i></dt>
280 <dd>
281 icon of the action (QIcon)
282 </dd><dt><i>text</i></dt>
283 <dd>
284 text of the action (string)
285 </dd><dt><i>parent</i></dt>
286 <dd>
287 reference to the parent object (QObject)
288 </dd>
289 </dl><dl>
290 <dt>Returns:</dt>
291 <dd>
292 reference to the created action (QAction)
293 </dd>
294 </dl><a NAME="E5ModelMenu.maxRows" ID="E5ModelMenu.maxRows"></a>
295 <h4>E5ModelMenu.maxRows</h4>
296 <b>maxRows</b>(<i></i>)
297 <p>
298 Public method to get the maximum number of entries to show.
299 </p><dl>
300 <dt>Returns:</dt>
301 <dd>
302 maximum number of entries to show (integer)
303 </dd>
304 </dl><a NAME="E5ModelMenu.model" ID="E5ModelMenu.model"></a>
305 <h4>E5ModelMenu.model</h4>
306 <b>model</b>(<i></i>)
307 <p>
308 Public method to get a reference to the model.
309 </p><dl>
310 <dt>Returns:</dt>
311 <dd>
312 reference to the model (QAbstractItemModel)
313 </dd>
314 </dl><a NAME="E5ModelMenu.mouseMoveEvent" ID="E5ModelMenu.mouseMoveEvent"></a>
315 <h4>E5ModelMenu.mouseMoveEvent</h4>
316 <b>mouseMoveEvent</b>(<i>evt</i>)
317 <p>
318 Protected method to handle mouse move events.
319 </p><dl>
320 <dt><i>evt</i></dt>
321 <dd>
322 reference to the event (QMouseEvent)
323 </dd>
324 </dl><a NAME="E5ModelMenu.mousePressEvent" ID="E5ModelMenu.mousePressEvent"></a>
325 <h4>E5ModelMenu.mousePressEvent</h4>
326 <b>mousePressEvent</b>(<i>evt</i>)
327 <p>
328 Protected method handling mouse press events.
329 </p><dl>
330 <dt><i>evt</i></dt>
331 <dd>
332 reference to the event object (QMouseEvent)
333 </dd>
334 </dl><a NAME="E5ModelMenu.mouseReleaseEvent" ID="E5ModelMenu.mouseReleaseEvent"></a>
335 <h4>E5ModelMenu.mouseReleaseEvent</h4>
336 <b>mouseReleaseEvent</b>(<i>evt</i>)
337 <p>
338 Protected method handling mouse release events.
339 </p><dl>
340 <dt><i>evt</i></dt>
341 <dd>
342 reference to the event object (QMouseEvent)
343 </dd>
344 </dl><a NAME="E5ModelMenu.postPopulated" ID="E5ModelMenu.postPopulated"></a>
345 <h4>E5ModelMenu.postPopulated</h4>
346 <b>postPopulated</b>(<i></i>)
347 <p>
348 Public method to add any actions after the tree.
349 </p><a NAME="E5ModelMenu.prePopulated" ID="E5ModelMenu.prePopulated"></a>
350 <h4>E5ModelMenu.prePopulated</h4>
351 <b>prePopulated</b>(<i></i>)
352 <p>
353 Public method to add any actions before the tree.
354 </p><dl>
355 <dt>Returns:</dt>
356 <dd>
357 flag indicating if any actions were added
358 </dd>
359 </dl><a NAME="E5ModelMenu.removeEntry" ID="E5ModelMenu.removeEntry"></a>
360 <h4>E5ModelMenu.removeEntry</h4>
361 <b>removeEntry</b>(<i>idx</i>)
362 <p>
363 Public method to remove a menu entry.
364 </p><dl>
365 <dt><i>idx</i></dt>
366 <dd>
367 index of the entry to be removed (QModelIndex)
368 </dd>
369 </dl><a NAME="E5ModelMenu.resetFlags" ID="E5ModelMenu.resetFlags"></a>
370 <h4>E5ModelMenu.resetFlags</h4>
371 <b>resetFlags</b>(<i></i>)
372 <p>
373 Public method to reset the saved internal state.
374 </p><a NAME="E5ModelMenu.rootIndex" ID="E5ModelMenu.rootIndex"></a>
375 <h4>E5ModelMenu.rootIndex</h4>
376 <b>rootIndex</b>(<i></i>)
377 <p>
378 Public method to get the index of the root item.
379 </p><dl>
380 <dt>Returns:</dt>
381 <dd>
382 index of the root item (QModelIndex)
383 </dd>
384 </dl><a NAME="E5ModelMenu.separatorRole" ID="E5ModelMenu.separatorRole"></a>
385 <h4>E5ModelMenu.separatorRole</h4>
386 <b>separatorRole</b>(<i></i>)
387 <p>
388 Public method to get the role of the separator.
389 </p><dl>
390 <dt>Returns:</dt>
391 <dd>
392 role of the separator (integer)
393 </dd>
394 </dl><a NAME="E5ModelMenu.setFirstSeparator" ID="E5ModelMenu.setFirstSeparator"></a>
395 <h4>E5ModelMenu.setFirstSeparator</h4>
396 <b>setFirstSeparator</b>(<i>offset</i>)
397 <p>
398 Public method to set the first separator.
399 </p><dl>
400 <dt><i>offset</i></dt>
401 <dd>
402 row number of the first separator (integer)
403 </dd>
404 </dl><a NAME="E5ModelMenu.setMaxRows" ID="E5ModelMenu.setMaxRows"></a>
405 <h4>E5ModelMenu.setMaxRows</h4>
406 <b>setMaxRows</b>(<i>rows</i>)
407 <p>
408 Public method to set the maximum number of entries to show.
409 </p><dl>
410 <dt><i>rows</i></dt>
411 <dd>
412 maximum number of entries to show (integer)
413 </dd>
414 </dl><a NAME="E5ModelMenu.setModel" ID="E5ModelMenu.setModel"></a>
415 <h4>E5ModelMenu.setModel</h4>
416 <b>setModel</b>(<i>model</i>)
417 <p>
418 Public method to set the model for the menu.
419 </p><dl>
420 <dt><i>model</i></dt>
421 <dd>
422 reference to the model (QAbstractItemModel)
423 </dd>
424 </dl><a NAME="E5ModelMenu.setRootIndex" ID="E5ModelMenu.setRootIndex"></a>
425 <h4>E5ModelMenu.setRootIndex</h4>
426 <b>setRootIndex</b>(<i>index</i>)
427 <p>
428 Public method to set the index of the root item.
429 </p><dl>
430 <dt><i>index</i></dt>
431 <dd>
432 index of the root item (QModelIndex)
433 </dd>
434 </dl><a NAME="E5ModelMenu.setSeparatorRole" ID="E5ModelMenu.setSeparatorRole"></a>
435 <h4>E5ModelMenu.setSeparatorRole</h4>
436 <b>setSeparatorRole</b>(<i>role</i>)
437 <p>
438 Public method to set the role of the separator.
439 </p><dl>
440 <dt><i>role</i></dt>
441 <dd>
442 role of the separator (integer)
443 </dd>
444 </dl><a NAME="E5ModelMenu.setStatusBarTextRole" ID="E5ModelMenu.setStatusBarTextRole"></a>
445 <h4>E5ModelMenu.setStatusBarTextRole</h4>
446 <b>setStatusBarTextRole</b>(<i>role</i>)
447 <p>
448 Public method to set the role of the status bar text.
449 </p><dl>
450 <dt><i>role</i></dt>
451 <dd>
452 role of the status bar text (integer)
453 </dd>
454 </dl><a NAME="E5ModelMenu.statusBarTextRole" ID="E5ModelMenu.statusBarTextRole"></a>
455 <h4>E5ModelMenu.statusBarTextRole</h4>
456 <b>statusBarTextRole</b>(<i></i>)
457 <p>
458 Public method to get the role of the status bar text.
459 </p><dl>
460 <dt>Returns:</dt>
461 <dd>
462 role of the status bar text (integer)
463 </dd>
464 </dl>
465 <div align="right"><a href="#top">Up</a></div>
466 <hr />
467 </body></html>

eric ide

mercurial