E5Gui/E5ModelToolBar.py

changeset 5736
000ea446ff4b
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
equal deleted inserted replaced
5735:f606dbe20be6 5736:000ea446ff4b
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 __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt5.QtCore import pyqtSignal, qVersion, Qt, QModelIndex, QPoint, QEvent 12 from PyQt5.QtCore import pyqtSignal, Qt, QModelIndex, QPoint, QEvent
13 from PyQt5.QtGui import QDrag, QPixmap, QIcon 13 from PyQt5.QtGui import QDrag, QPixmap, QIcon
14 from PyQt5.QtWidgets import QApplication, QToolBar, QToolButton 14 from PyQt5.QtWidgets import QApplication, QToolBar, QToolButton
15
16 from Globals import qVersionTuple
15 17
16 18
17 class E5ModelToolBar(QToolBar): 19 class E5ModelToolBar(QToolBar):
18 """ 20 """
19 Class implementing a tool bar populated from a QAbstractItemModel. 21 Class implementing a tool bar populated from a QAbstractItemModel.
249 assert idx.isValid() 251 assert idx.isValid()
250 252
251 drag = QDrag(self) 253 drag = QDrag(self)
252 drag.setMimeData(self.__model.mimeData([idx])) 254 drag.setMimeData(self.__model.mimeData([idx]))
253 actionRect = self.actionGeometry(act) 255 actionRect = self.actionGeometry(act)
254 if qVersion() >= "5.0.0": 256 if qVersionTuple() >= (5, 0, 0):
255 drag.setPixmap(self.grab(actionRect)) 257 drag.setPixmap(self.grab(actionRect))
256 else: 258 else:
257 drag.setPixmap(QPixmap.grabWidget(self, actionRect)) 259 drag.setPixmap(QPixmap.grabWidget(self, actionRect))
258 260
259 if drag.exec_() == Qt.MoveAction: 261 if drag.exec_() == Qt.MoveAction:

eric ide

mercurial