[PyKDE] PuzzleWidget from puzzle example creates copies
apaku at gmx.de
Thu Jan 5 19:55:51 GMT 2006
as Phil missed that there are 2 puzzle-examples (one using a listview
one using a listwidget) I ported the dragandrop puzzle example (the
one in draganddrop in PyQt4 is actually the listview version). Now using
the C++ code I get a PuzzleWidget that actually creates copies when
dragging and droping within it. I tracked this down to the following:
print "pieceRects length before drag.start", len(self.pieceRects)
if drag.start(QtCore.Qt.MoveAction) == QtCore.Qt.MoveAction:
print "pieceRects length after drag.start", len(self.pieceRects)
This is in the mousepressEvent and it's the same in the currently
included puzzle-example from PyQt4-snapshot-20060104, except for the
if-condition. In the included puzzle-example it compares to "0" instead
of QtCore.Qt.MoveAction, while the C++ code of the
draganddrop-puzzle-example compares to Qt::MoveAction as above.
Now when I use the Qt::MoveAction comparison, the 2nd print prints "1"
when the first one prints 0 and that really puzzles me. This is with one
object in the list of course before dragging and a few lines above that
object is removed from piecesRects via:
where found is "0". I don't understand why suddenly self.pieceRects has
an element again.
While this might or might not be the real cause of the problem I also
think that Qt::IgnoreAction (or "0") should be used for the comparison
as that makes much more sense regarding the logic. I've posted that last
issue on qt-interest already and will discuss it there as Trolls
sometimes read mails there and maybe they know a reason for the code.
Good night to spend with family, but avoid arguments with your mate's
More information about the PyQt