dndwidgets testing new behavior

This commit is contained in:
Simon Renblad 2024-01-12 17:45:52 +08:00
parent fed15816c4
commit fa5d7fe877

View File

@ -21,6 +21,25 @@ class DragDropSplitter(QtWidgets.QSplitter):
def dragMoveEvent(self, e):
pos = e.pos()
src = e.source()
src_i = self.indexOf(src)
# case 0: smaller than source widget
if pos.y() < src.y():
for n in range(src_i):
w = self.widget(n)
if pos.y() < w.y() + w.size().height():
self.setRubberBand(w.y())
break
# case 2: greater than source widget
elif pos.y() > src.y() + src.size().height():
for n in range(src_i):
w = self.widget(n)
if pos.y() < w.y() + w.size().height():
self.setRubberBand(w.y())
break
else:
self.setRubberBand(-1)
for n in range(self.count()):
w = self.widget(n)
if self.orientation() == QtCore.Qt.Vertical: