dndwidgets: change splitter to use signal

This commit is contained in:
Simon Renblad 2024-01-24 10:37:54 +08:00 committed by Sébastien Bourdeauducq
parent 6c9f1cbf7c
commit 3861d58749
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,8 @@ from PyQt5 import QtCore, QtWidgets
class VDragDropSplitter(QtWidgets.QSplitter): class VDragDropSplitter(QtWidgets.QSplitter):
dropped = QtCore.pyqtSignal(int, int)
def __init__(self, parent): def __init__(self, parent):
QtWidgets.QSplitter.__init__(self, parent=parent) QtWidgets.QSplitter.__init__(self, parent=parent)
self.setAcceptDrops(True) self.setAcceptDrops(True)
@ -50,7 +52,7 @@ class VDragDropSplitter(QtWidgets.QSplitter):
for n in range(self.count()): for n in range(self.count()):
w = self.widget(n) w = self.widget(n)
if pos.y() < w.y() + w.size().height(): if pos.y() < w.y() + w.size().height():
self.insertWidget(n, src) self.dropped.emit(src_i, n)
break break
e.accept() e.accept()