Unfortunately I can't watch the video at the moment to see what is being suggested (will check that out later) but I can already tell you that you are mixing pieces together that don't normally go together.
QTreeWidget is a convenience class meant to act as a standalone widget. it contains its own internal model and represents the data as QTreeWidgetItems. You interact at the item level to add children. QAbstractItemModel is the abstract base class for creating model/view implementations. In this approach, you can store whatever private data structure you want, and implement the interface to make the model suitable to be used with views like QTreeView. QTreeWidgetItem (including the root item) accept only QTreeWidgetItem subclasses, which is where you error comes from. My assumption is that the appropriate approach would be to store your custom Node structure within the model, and then simply plug the model into a QTreeView to visualize it. If you are working with a QTreeWidget, then you should have no use for a custom model. On Thu, Oct 17, 2013 at 8:17 AM, Bay <[email protected]> wrote: > Hi Justin, > thank you so much for your explanation. > > > The conflict right now that I'm getting is while I could use > a QTreeWidget's invisible root item and set it up as my "World", I seemed > to be unable to add child items to my model and lost access to my Node > class that processed the information from my Model. > > Getting errors such as this: > # TypeError: QTreeWidgetItem.insertChild(int, QTreeWidgetItem): argument 2 > has unexpected type 'Node' > > The tutorial I'm following is this : > http://www.youtube.com/watch?v=VcN94yMOkyU&list=PLJewNuO700GfElihmE9R8zManDym4S13m > > What I'm trying to make is a more interactive selection set menu where I > can add/remove/rename objects from the menu. Attached are my files if that > would help. > > Again thank you for the assistance. > > -- > 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/b86c63c2-543e-4cf8-8c02-4d1868d9e2a4%40googlegroups.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > -- 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/CAPGFgA3CiK6Jup2OHrmHMztD28cwYfW0UXU2y_F5rgPz5hagPA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
