forked from M-Labs/artiq
dndwidgets: improvements
This commit is contained in:
parent
19bcc2357b
commit
780e0bada8
@ -23,6 +23,7 @@ class DragDropSplitter(QtWidgets.QSplitter):
|
||||
pos = e.pos()
|
||||
src = e.source()
|
||||
src_i = self.indexOf(src)
|
||||
self.setRubberBand(self.height())
|
||||
# case 0: smaller than source widget
|
||||
if pos.y() < src.y():
|
||||
for n in range(src_i):
|
||||
@ -34,8 +35,8 @@ class DragDropSplitter(QtWidgets.QSplitter):
|
||||
elif pos.y() > src.y() + src.size().height():
|
||||
for n in range(src_i + 1, self.count()):
|
||||
w = self.widget(n)
|
||||
if pos.y() < w.y() + w.size().height():
|
||||
self.setRubberBand(w.y() + w.size().height())
|
||||
if pos.y() < w.y():
|
||||
self.setRubberBand(w.y())
|
||||
break
|
||||
else:
|
||||
self.setRubberBand(-1)
|
||||
@ -46,16 +47,7 @@ class DragDropSplitter(QtWidgets.QSplitter):
|
||||
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.insertWidget(n, src)
|
||||
break
|
||||
# case 2: greater than source widget
|
||||
elif pos.y() > src.y() + src.size().height():
|
||||
for n in range(src_i + 1, self.count()):
|
||||
for n in range(self.count()):
|
||||
w = self.widget(n)
|
||||
if pos.y() < w.y() + w.size().height():
|
||||
self.insertWidget(n, src)
|
||||
|
Loading…
Reference in New Issue
Block a user