10 from PyQt4.QtCore import * |
10 from PyQt4.QtCore import * |
11 from PyQt4.QtGui import * |
11 from PyQt4.QtGui import * |
12 |
12 |
13 from .E5ModelMenu import E5ModelMenu |
13 from .E5ModelMenu import E5ModelMenu |
14 |
14 |
|
15 |
15 class E5ModelToolBar(QToolBar): |
16 class E5ModelToolBar(QToolBar): |
16 """ |
17 """ |
17 Class implementing a tool bar populated from a QAbstractItemModel. |
18 Class implementing a tool bar populated from a QAbstractItemModel. |
18 |
19 |
19 @signal activated(QModelIndex) emitted when an action has been triggered |
20 @signal activated(QModelIndex) emitted when an action has been triggered |
20 """ |
21 """ |
21 activated = pyqtSignal(QModelIndex) |
22 activated = pyqtSignal(QModelIndex) |
22 |
23 |
23 def __init__(self, title = None, parent = None): |
24 def __init__(self, title=None, parent=None): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 |
27 |
27 @param title title for the tool bar (string) |
28 @param title title for the tool bar (string) |
28 @param parent reference to the parent widget (QWidget) |
29 @param parent reference to the parent widget (QWidget) |
204 row = self.__model.rowCount(idx) |
205 row = self.__model.rowCount(idx) |
205 |
206 |
206 self.__dropRow = row |
207 self.__dropRow = row |
207 self.__dropIndex = parentIndex |
208 self.__dropIndex = parentIndex |
208 evt.acceptProposedAction() |
209 evt.acceptProposedAction() |
209 self.__model.dropMimeData(evt.mimeData(), evt.dropAction(), |
210 self.__model.dropMimeData(evt.mimeData(), evt.dropAction(), |
210 row, 0, parentIndex) |
211 row, 0, parentIndex) |
211 |
212 |
212 QToolBar.dropEvent(self, evt) |
213 QToolBar.dropEvent(self, evt) |
213 |
214 |
214 def mouseMoveEvent(self, evt): |
215 def mouseMoveEvent(self, evt): |