E5Gui/E5ModelMenu.py

branch
5_3_x
changeset 2468
957f6e1d97e1
parent 2302
f29e9405c851
child 2525
8b507a9a2d40
child 2953
703452a2876f
child 3163
9f50365a0870
equal deleted inserted replaced
2466:6739502248ef 2468:957f6e1d97e1
5 5
6 """ 6 """
7 Module implementing a menu populated from a QAbstractItemModel. 7 Module implementing a menu populated from a QAbstractItemModel.
8 """ 8 """
9 9
10 from PyQt4.QtCore import pyqtSignal, Qt, QModelIndex, QPoint 10 from PyQt4.QtCore import pyqtSignal, qVersion, Qt, QModelIndex, QPoint
11 from PyQt4.QtGui import QMenu, QFontMetrics, QAction, QApplication, QDrag, QPixmap 11 from PyQt4.QtGui import QMenu, QFontMetrics, QAction, QApplication, QDrag, QPixmap
12 12
13 import UI.PixmapCache 13 import UI.PixmapCache
14 14
15 15
376 return 376 return
377 377
378 drag = QDrag(self) 378 drag = QDrag(self)
379 drag.setMimeData(self.__model.mimeData([idx])) 379 drag.setMimeData(self.__model.mimeData([idx]))
380 actionRect = self.actionGeometry(act) 380 actionRect = self.actionGeometry(act)
381 drag.setPixmap(QPixmap.grabWidget(self, actionRect)) 381 if qVersion() >= "5.0.0":
382 drag.setPixmap(self.grab(actionRect))
383 else:
384 drag.setPixmap(QPixmap.grabWidget(self, actionRect))
382 385
383 if drag.exec_() == Qt.MoveAction: 386 if drag.exec_() == Qt.MoveAction:
384 row = idx.row() 387 row = idx.row()
385 if self.__dropIndex == idx.parent() and self.__dropRow <= row: 388 if self.__dropIndex == idx.parent() and self.__dropRow <= row:
386 row += 1 389 row += 1

eric ide

mercurial