Le 25/05/11 20:28, Anne-Laure Terrettaz-Zufferey a écrit :
Hello,



I would like to drag and drop items from a Qlistwidget to another and get the dragged and dropped items from the second Qlistwidget. Drag and drop works  but impossible to get the items. I don't know how to connect the second Qlistwidget in which the items are dropped and say to him that it has received item and what they are. The QlistwidgetgetItem function send back nothing.

Thanks in advance

Anne-Laure

_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Hello,

In your first QListWidget, in function startDrag, you can use QtCore.QMimeData()
to preserve the type of the object you are dragging.

Something like that:

        mimeData = QtCore.QMimeData()
        mimeData.setText(fileName)    # filename or index in the list or any other data that describe the object

        drag = QtGui.QDrag(self)
        drag.setMimeData(mimeData)

and, in your second QListWidget:

    def dropEvent(self, event):
        data = "">         if data.text() == "data_expected":
            ...

Regards

--
Vincent V.V.
Oqapy


_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to