--
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/CAM33%3Da4_R8YYmG_BOG0nnh%2BHGVQrWhvbrFTCM%2BOjoWmxHx4W_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Rather than serialising and de-serialising your item each time, you could instead keep track of origin and destination indexes of the operation; and then re-order the items accordingly.
For example, if you’ve got these items in your model.
item0
item1
item2
item3
And in your drag and drop operation, you take the item at index 0 (only keeping track of the index in dropMimeData) and drop it at index 2 then you might expect your model to look like this.
item1
item2
item0
item3
And once you’ve know that, you can either sort it manually to match or use something like moveRow of QAbstractItemModel and have the model handle how it should all end up.
It saves you the trouble of serialisation, at the cost of not being able to drop it anywhere else, like a text editor, as the index doesn’t really mean much on its own.
--
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_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da6U7RYaWUVBFaxCLuhzMzWAB%3DYU_UPOdg0A0CetR%2BH9KA%40mail.gmail.com.
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/CAPGFgA0rK435D%2BC47gx1AgSJuRxhbm7ZfQSzKZnNzaeJgxpuqw%40mail.gmail.com.