forked from M-Labs/artiq
dndwidgets testing new behavior
This commit is contained in:
parent
fed15816c4
commit
fa5d7fe877
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user