QMimeData: setting and getting the right MIME types for arbitrary widgets
问题 Using PySide, I construct a draggable label that works exactly how I want: class DraggableLabel(QtGui.QLabel): def __init__(self, txt, parent): QtGui.QLabel.__init__(self, txt, parent) self.setStyleSheet("QLabel { background-color: rgb(255, 255, 0)}") def mouseMoveEvent(self, event): drag=QtGui.QDrag(self) dragMimeData=QtCore.QMimeData() drag.setMimeData(dragMimeData) drag.exec_(QtCore.Qt.MoveAction) (Note a full example that uses DraggableLabel is pasted below). Unfortunately, I do not