<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Le 25/05/11 20:28, Anne-Laure Terrettaz-Zufferey a écrit :
<blockquote
cite="mid:EFE7E7AD-B620-4106-AE6D-1C8089D87516@gmail.com"
type="cite">
<div><span class="Apple-style-span" style="border-collapse:
separate; color: rgb(0, 0, 0); font-family: 'Gill Sans';
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: 'Gill Sans'; font-size:
medium; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
normal; orphans: 2; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;">
<div style="word-wrap: break-word;"><span
class="Apple-style-span" style="border-collapse:
separate; color: rgb(0, 0, 0); font-family: 'Gill Sans';
font-size: medium; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: 2; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px;">
<div style="word-wrap: break-word;">Hello,<br>
<br>
<br>
<br>
</div>
</span></div>
</span></span>
</div>
<div>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.</div>
<div><br>
</div>
<div>Thanks in advance</div>
<div><br>
</div>
<div>Anne-Laure</div>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PyQt mailing list <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
</blockquote>
Hello,<br>
<br>
In your first QListWidget, in function startDrag, you can use
QtCore.QMimeData() <br>
to preserve the type of the object you are dragging.<br>
<br>
Something like that:<br>
<br>
mimeData = QtCore.QMimeData()<br>
mimeData.setText(fileName) # filename or index in the
list or any other data that describe the object<br>
<br>
drag = QtGui.QDrag(self)<br>
drag.setMimeData(mimeData)<br>
<br>
and, in your second QListWidget:<br>
<br>
def dropEvent(self, event):<br>
data = event.mimeData()<br>
if data.text() == "data_expected":<br>
...<br>
<br>
Regards<br>
<br>
<div class="moz-signature">-- <br>
Vincent V.V.<br>
<a href="https://launchpad.net/oqapy">Oqapy</a></div>
</body>
</html>