E5Gui/E5ModelToolBar.py

changeset 2467
33f1bcfdd65e
parent 2401
4f428de32b69
child 2525
8b507a9a2d40
child 2990
583beaf0b4b8
equal deleted inserted replaced
2464:d6bba153dd43 2467:33f1bcfdd65e
5 5
6 """ 6 """
7 Module implementing a tool bar populated from a QAbstractItemModel. 7 Module implementing a tool bar populated from a QAbstractItemModel.
8 """ 8 """
9 9
10 from PyQt4.QtCore import pyqtSignal, Qt, QModelIndex, QPoint, QEvent 10 from PyQt4.QtCore import pyqtSignal, qVersion, Qt, QModelIndex, QPoint, QEvent
11 from PyQt4.QtGui import QApplication, QDrag, QPixmap, QToolBar, QIcon, QToolButton 11 from PyQt4.QtGui import QApplication, QDrag, QPixmap, QToolBar, QIcon, QToolButton
12 12
13 13
14 class E5ModelToolBar(QToolBar): 14 class E5ModelToolBar(QToolBar):
15 """ 15 """
239 assert idx.isValid() 239 assert idx.isValid()
240 240
241 drag = QDrag(self) 241 drag = QDrag(self)
242 drag.setMimeData(self.__model.mimeData([idx])) 242 drag.setMimeData(self.__model.mimeData([idx]))
243 actionRect = self.actionGeometry(act) 243 actionRect = self.actionGeometry(act)
244 drag.setPixmap(QPixmap.grabWidget(self, actionRect)) 244 if qVersion() >= "5.0.0":
245 drag.setPixmap(self.grab(actionRect))
246 else:
247 drag.setPixmap(QPixmap.grabWidget(self, actionRect))
245 248
246 if drag.exec_() == Qt.MoveAction: 249 if drag.exec_() == Qt.MoveAction:
247 row = idx.row() 250 row = idx.row()
248 if self.__dropIndex == idx.parent() and self.__dropRow <= row: 251 if self.__dropIndex == idx.parent() and self.__dropRow <= row:
249 row += 1 252 row += 1

eric ide

mercurial