E5Gui/E5ModelToolBar.py

branch
5_3_x
changeset 2468
957f6e1d97e1
parent 2302
f29e9405c851
child 3163
9f50365a0870
equal deleted inserted replaced
2466:6739502248ef 2468:957f6e1d97e1
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 from .E5ModelMenu import E5ModelMenu 13 from .E5ModelMenu import E5ModelMenu
14 14
15 15
240 assert idx.isValid() 240 assert idx.isValid()
241 241
242 drag = QDrag(self) 242 drag = QDrag(self)
243 drag.setMimeData(self.__model.mimeData([idx])) 243 drag.setMimeData(self.__model.mimeData([idx]))
244 actionRect = self.actionGeometry(act) 244 actionRect = self.actionGeometry(act)
245 drag.setPixmap(QPixmap.grabWidget(self, actionRect)) 245 if qVersion() >= "5.0.0":
246 drag.setPixmap(self.grab(actionRect))
247 else:
248 drag.setPixmap(QPixmap.grabWidget(self, actionRect))
246 249
247 if drag.exec_() == Qt.MoveAction: 250 if drag.exec_() == Qt.MoveAction:
248 row = idx.row() 251 row = idx.row()
249 if self.__dropIndex == idx.parent() and self.__dropRow <= row: 252 if self.__dropIndex == idx.parent() and self.__dropRow <= row:
250 row += 1 253 row += 1

eric ide

mercurial