When I reimplement the dragEnterEvent and dropEvent in the view itself, the drag and drop functionality within the model no longer works... files are not moved, nothing happens other than the print statements I have inside the dropEvent in the view class.Is this normal behaviour for the view to override the drop code inside my model? Or should I let the view handle the drop? If the latter, then I would need to find the index of the item dropped to from the view.Here is the shortnened code for my tree model:
If anyone can help me with this I would be very grateful :)Peace!Ben
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/59cc4287-d876-4774-9116-14a9cc2185bcn%40googlegroups.com.
Ok, after you pointed me towards super I looked into it and stumbled across all the right solutions to do this.Inside my treemodel I am adding an additional custom mime data type and checking for that inside the view. If its custom I call super and if not I call the normal event accept and run the other code I need to drop in a directory from the system :)
--On Thursday, 26 May 2022 at 21:24:12 UTC+2 Benjam901 wrote:I was wondering if that might be the way to go also, but if both instances of the drop event require that a file url be present then both would need to call accept() right?Do you have any examples of this behaviour you could point me toward? Also, I am not 100% clear on the super() event handler// BenOn Thursday, 26 May 2022 at 21:14:59 UTC+2 justin...@gmail.com wrote:On Fri, 27 May 2022, 3:54 am Benjam901, <benandr...@gmail.com> wrote:When I reimplement the dragEnterEvent and dropEvent in the view itself, the drag and drop functionality within the model no longer works... files are not moved, nothing happens other than the print statements I have inside the dropEvent in the view class.Is this normal behaviour for the view to override the drop code inside my model? Or should I let the view handle the drop? If the latter, then I would need to find the index of the item dropped to from the view.Here is the shortnened code for my tree model:Hey Ben. It's because your overrides for the event handlers are always calling accept() on the event. You need to check the mimetype and if you decide its not something you are going to handle then don't call accept so that the event can propagate. But you should probably also call the super() event handler as well if you want the original view handler code to be able to try default drop behavior.If anyone can help me with this I would be very grateful :)Peace!Ben--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/59cc4287-d876-4774-9116-14a9cc2185bcn%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4f1e1698-b662-4f6a-8068-9784a51a7cb7n%40googlegroups.com.