It looks like I've started to figure out how to do what I need to do. Added the following lines to the "customTable" class:
# Custom headers
HH = customQHeaderView(parent = self, orientation=Qt.Horizontal)
VH = customQHeaderView(parent = self, orientation=Qt.Vertical)
self.setHorizontalHeader(HH)
self.setVerticalHeader(VH)
And added new class "customQHeaderView":
class customQHeaderView(QHeaderView):
MimeType = 'application/x-qabstractitemmodeldatalist'
def __init__(self, orientation: Qt.Orientation, parent=None):
super().__init__(orientation, parent)
self.setDragEnabled(True)
self.setAcceptDrops(True)
def dropEvent(self, event):
mimedata = event.mimeData()
if mimedata.hasFormat(customQHeaderView.MimeType):
if event.source() is not self:
source_item = QStandardItemModel()
source_item.dropMimeData(mimedata, Qt.CopyAction, 0,0, QModelIndex())
label = source_item.item(0, 0).text()
print(label)
event.setDropAction(Qt.MoveAction)
event.accept()
else:
event.ignore()
else:
super().dropEvent(event)