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