[PyQt] Drag & Drop with QTreeWidget

NARCISO, Rui RUI.NARCISO at airbus.com
Wed Dec 2 12:59:36 GMT 2009


>> 
>> I have several question (tree = QTreeWidget())
>>  1) I have activated:
>> 	tree.setSelectionMode(QAbstractView.ExtendedSelection)
>>     yet before I would just keep the mouse pressed and slide over 
>> the selection I wanted but now that is not possible. Is there a way 
>> to maintain such behaviour and force that the drag is only performed 
>> on a second click over the selection ?
>
>not sure i undertstand what you mean - but i would have thought the 
>selection behaviour changed because you enabled drag and drop, not 
>because you changed the selection mode.

I wasn't clear on my explanation.
Before trying any Drag'n'Drop I had QAbstractView.ExtendedSelection and now, with Drag'n'Drop I have a different behaviour.

I would like to keep the same behaviour as before ...


>> and when doing so create the sub-node "Folder1" if it does not exist within 
>> "campaign" and put the dragged items under "folder1" (and not 
>> "campaign" where they were dropped). How to do this ? Do I do this 
>> in a dropEvent? In a dropEventAction ?

>you could monitor the tree using QTreeView.rowsInserted and then 
>reparent dropped items as necessary.

I will take a look at this ...

The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free.




More information about the PyQt mailing list