[PyKDE] PuzzleWidget from puzzle example creates copies

Phil Thompson phil at riverbankcomputing.co.uk
Fri Jan 6 09:35:41 GMT 2006

On Thursday 05 January 2006 7:55 pm, Andreas Pakulat wrote:
> Hi,
> 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:
> del self.pieceRects[found]
> 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.

I'm not sure if you are reporting a PyQt4 bug. If so, a short test script 
demonstrating the problem will help.


More information about the PyQt mailing list