eric6/E5Gui/E5ModelToolBar.py

branch
without_py2_and_pyqt4
changeset 7198
684261ef2165
parent 6942
2602857055c5
child 7229
53054eb5b15a
equal deleted inserted replaced
7197:331569d44b19 7198:684261ef2165
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt5.QtCore import pyqtSignal, 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, QIcon
14 from PyQt5.QtWidgets import QApplication, QToolBar, QToolButton 14 from PyQt5.QtWidgets import QApplication, QToolBar, QToolButton
15
16 from Globals import qVersionTuple
17 15
18 16
19 class E5ModelToolBar(QToolBar): 17 class E5ModelToolBar(QToolBar):
20 """ 18 """
21 Class implementing a tool bar populated from a QAbstractItemModel. 19 Class implementing a tool bar populated from a QAbstractItemModel.
251 assert idx.isValid() 249 assert idx.isValid()
252 250
253 drag = QDrag(self) 251 drag = QDrag(self)
254 drag.setMimeData(self.__model.mimeData([idx])) 252 drag.setMimeData(self.__model.mimeData([idx]))
255 actionRect = self.actionGeometry(act) 253 actionRect = self.actionGeometry(act)
256 if qVersionTuple() >= (5, 0, 0): 254 drag.setPixmap(self.grab(actionRect))
257 drag.setPixmap(self.grab(actionRect))
258 else:
259 drag.setPixmap(QPixmap.grabWidget(self, actionRect))
260 255
261 if drag.exec_() == Qt.MoveAction: 256 if drag.exec_() == Qt.MoveAction:
262 row = idx.row() 257 row = idx.row()
263 if self.__dropIndex == idx.parent() and self.__dropRow <= row: 258 if self.__dropIndex == idx.parent() and self.__dropRow <= row:
264 row += 1 259 row += 1

eric ide

mercurial