[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Why doesn't QListWidget emit indexesMoved(QModelIndexList)
From:       LIM Fung-Chai <lim.fung.chai () gmail ! com>
Date:       2009-02-24 2:56:07
Message-ID: c1f890860902231856u30d6a318xbbd413b9dee969ad () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

After creating a QListWidget, I enabled dragging and set drag-drop-mode to
QAbstractItemView.InternalMove.  I am able to re-order the QListWidgetItems
within this widget by selecting and dragging the selected items around.  But
when I drop the selected items, shouldn't an indexedMoved signal be emitted?

Here is my code:
def moved (self, indexes):
    print "moved"

app = QApplication (sys.argv)
widget = QListWidget()
widget.setAcceptDrops (True)
widget.setDragEnabled (True)
widget.setDragDropMode (QAbstractItemView.InternalMove)
QObject.connect (widget, SIGNAL ("indexesMoved(QModelIndexList)"), moved)

QListWidgetItem ("item 1", widget)
QListWidgetItem ("item 2", widget)
QListWidgetItem ("item 3", widget)
QListWidgetItem ("item 4", widget)

widget.show()
app.exec_()

When I moved an item around, moved() should have been invoked, but is not.
Why?  I am using PyQt v3.17.6.  Thanks in advance.

Regards,
Fung Chai.

-- 
FWIW: $\lnot \exists x \, {\rm Right} (x) \leftarrow \forall x \, {\rm
Wrong} (x)$ \hfill -- Stephen Stills

Freedom's just another word for nothin' left to lose -- Kris Kristofferson

[Attachment #5 (text/html)]

Hi,<br><br>After creating a QListWidget, I enabled dragging and set drag-drop-mode to \
QAbstractItemView.InternalMove.&nbsp; I am able to re-order the QListWidgetItems \
within this widget by selecting and dragging the selected items around.&nbsp; But \
when I drop the selected items, shouldn&#39;t an indexedMoved signal be emitted?<br> \
<br>Here is my code:<br><div style="margin-left: 40px;">def moved (self, \
indexes):<br>&nbsp;&nbsp;&nbsp; print &quot;moved&quot;<br><br>app = QApplication \
(sys.argv)<br>widget = QListWidget()<br>widget.setAcceptDrops \
(True)<br>widget.setDragEnabled (True)<br> widget.setDragDropMode \
(QAbstractItemView.InternalMove)<br>QObject.connect (widget, SIGNAL \
(&quot;indexesMoved(QModelIndexList)&quot;), moved) <br><br>QListWidgetItem \
(&quot;item 1&quot;, widget)<br>QListWidgetItem (&quot;item 2&quot;, widget)<br> \
QListWidgetItem (&quot;item 3&quot;, widget)<br>QListWidgetItem (&quot;item 4&quot;, \
widget)<br></div><br><div style="margin-left: \
40px;">widget.show()<br>app.exec_()<br></div><br>When I moved an item around, moved() \
should have been invoked, but is not.&nbsp; Why?&nbsp; I am using PyQt v3.17.6.&nbsp; \
Thanks in advance.<br> <br>Regards,<br>Fung Chai.<br clear="all"><br>-- <br>FWIW: \
$\lnot \exists x \, {\rm Right} (x) \leftarrow \forall x \, {\rm Wrong} (x)$ \hfill \
-- Stephen Stills<br><br>Freedom&#39;s just another word for nothin&#39; left to lose \
-- Kris Kristofferson<br>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic