[PyQt] Problem coding QListWidget

piotr maliński riklaunim at gmail.com
Tue Dec 16 08:01:28 GMT 2008


I'm trying to use QListWidget to make basic file manager. Here:
http://www.wklej.org/id/28628/ is a example code of a problem that I have.
If I use mousePressEvent, then SelectionMode doesn't work properly
(selection range is from top-left corner to cursor position, not the area
selected by the cursor on mouse pressed), and moving items is bit broken
(item is not moved to the new cursor position, but far far away :)). So the
question is - how should I implement events for mouse clicks, dragging etc.
without making "conflicts" between them like with mousePressEvent?
I need:
- Right click for item menu ( ?? , mouseReleaseEvent)
- Left click (single or maybe double) for activating the item (go to
directory or open file) ( mouseDoubleClickEvent or ??)
- drag & drop to move items to a folder (dropEvent, how to enable drops on
widget own items?)
- keyboard events (ctr+c/v/x) (keyPressEvent &
event.matches(QKeySequence.*))
Currently I use only mouseReleaseEvent and mousePressEvent for the basic
stuff and the mousePressEvent is making problems. Another one is with moving
items - I can select them, move and drop but they end up in two places - old
one (where they still are), and in the new place (only "drawing", trying to
select them will clear the area) - I'm guessing it might be another conflict
or something (http://www.rk.edu.pl/test.ogv -- screencast with the problem).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20081216/3aeb46b6/attachment.html


More information about the PyQt mailing list