remove drag and drop shims

used only in one place in the codebase
This commit is contained in:
KIU Shueng Chuan 2021-02-14 07:44:00 +08:00
parent f4d685f7bd
commit 968286a1cf
3 changed files with 6 additions and 5 deletions

View File

@ -432,10 +432,8 @@ if QT_LIB == PYQT6:
QtGui.QSinglePointEvent.localPos = lambda o : o.position()
QtGui.QSinglePointEvent.windowPos = lambda o : o.scenePosition()
QtGui.QSinglePointEvent.screenPos = lambda o : o.globalPosition()
QtGui.QDropEvent.posF = lambda o : o.position()
QtWidgets.QApplication.exec_ = QtWidgets.QApplication.exec
QtGui.QDrag.exec_ = lambda o : o.exec()
# PyQt6 6.0.0 has a bug where it can't handle certain Type values returned
# by the Qt library.

View File

@ -198,7 +198,7 @@ class Dock(QtGui.QWidget, DockDrop):
self.drag.setMimeData(mime)
self.widgetArea.setStyleSheet(self.dragStyle)
self.update()
action = self.drag.exec_()
action = self.drag.exec_() if hasattr(self.drag, 'exec_') else self.drag.exec()
self.updateStyle()
def float(self):

View File

@ -30,9 +30,12 @@ class DockDrop(object):
def dragMoveEvent(self, ev):
#print "drag move"
ld = ev.posF().x()
# QDragMoveEvent inherits QDropEvent which provides posF()
# PyQt6 provides only position()
posF = ev.posF() if hasattr(ev, 'posF') else ev.position()
ld = posF.x()
rd = self.width() - ld
td = ev.posF().y()
td = posF.y()
bd = self.height() - td
mn = min(ld, rd, td, bd)