Well, speaking from the perspective of custom QAbstractItemModel with
QTreeViews or QTableViews, that's EXACTLY the path.  I'm going to test with
the Convenience widgets though, so I'll keep you posted.  The basics are
these: mime data is binary, and you can attach it to an arbitrary label of
datatype.  That data type can be whatever you want it to be (although there
are some standard ones such as 'text/html' and whatnot.  I personally make
my own, eg 'application/x-hierarchy-block'.  Then you just push a stream of
the data you want to encode.  In several of my projects, that was the
output of the repr() method for the object being dragged.  in others, it
might be a node id, or pretty much anything you want.  It just depends on
the use case.

I keep trying to find a use case for the convenience widgets (QTreeWidget
etc), and at least in my experience, while they're great for one-time use
data, most of my projects use persistance, so I've ended up going more into
the custom models and hooking up views.  When you go that route, though,
there's a lot more boilerplate you have to set up, so keep that in mind.

As I said, I'll get something coded up today to test it out.

On Wed, Apr 22, 2015 at 9:08 AM, Benjam901 <[email protected]> wrote:

> Hello Joe,
>
> That would be a massive help thank you very much.
>
> I have found something online that has mentioned decoding the mimedata
> using QDataStream which indicates to me that the data is binary. If this is
> the case I would really like to be able to set my mime data myself so that
> decoding it is a little easier. That being said, my current experience in
> encoding/decoding binary data is limited. Would this be a good path to
> wander down?
>
> http://pythonically.blogspot.se/2009/11/drag-and-drop-in-pyqt.html
>
> Cheers,
>
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/8095ee58-77f0-4766-bd75-768b44e903c4%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/8095ee58-77f0-4766-bd75-768b44e903c4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da5rW8Dus%2BWgOSb888GHdtrHc7B9Y11WXAkkWbnENNS8RQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to