[PyQt] question on drag and drop

Hans-Peter Jansen hpj at urpla.net
Wed Oct 20 19:46:49 BST 2010


On Wednesday 20 October 2010, 18:18:12 danny wrote:
> > whenever i encounter situations where i'm going to reimplement
> > virtual methods, i will usually take a look at the qt source at
> > some point. i will look at the details of the default
> > implementation, and also how the method is used internally by other
> > methods. if the method is part of an abstract class, i might also
> > look at how qt has reimplemented it in its own subclasses (for
> > example, by comparing qtreeview with qtreewidget). why waste time
> > designing everything from scratch when the kindly trolls have
> > already done most of it for me?
> >
> > the qt documentation is good, but there is no substitute for
> > reading the source when you really need to know how things work.
>
> I have just finally gotten to the point where I know enough to be
> able to use the source code :-).

Congrats.

> I discovered how to modify the 
> internal default drop action using the undocumented
> setDefaultDropAction on the view, by looking at the source code. Baby
> steps.

Hey Danny, cheer up! The good news are, that 
QAbstractItemView.setDefaultDropAction() isn't exactly undocumented, 
see http://doc.trolltech.com/4.6/qabstractitemview.html. Otherwise that 
would be a major pity, since Phil refuses to implement any undocumented 
Qt properties unwaveringly.

But I agree with Baz, that reading the source in such cases is pretty 
enlightening (after having learned to ignore the superfluous parts ;-).

Pete


More information about the PyQt mailing list