[PyQt] question on drag and drop

Baz Walter bazwal at ftml.net
Tue Oct 19 22:56:45 BST 2010


On 19/10/10 21:07, danny wrote:
>
>> when your reimplemented mimeTypes() method is called internally by qt,
>> the first item in the returned list will be used to set the format.
>>
>
> Ok, I think I get it. Internal DnD will use the first specified mime type.
>
> That still raises the question of the purpose of the mimeType() method. The
> documentation implies that mimeType() specifies the formats supplied when used
> as a drop source. How do you control the accepted types when used as a drop
> target? Or is mimeType() used for both drop source and target?

i'm going to answer your questions by not answering them :)

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.


More information about the PyQt mailing list