My recommendation is to try your model against ModelTest, which has been ported from Qt to PySide (You should be able to just change the PySide import to PyQt4): http://modeltest-pyside.googlecode.com/svn/trunk/ModelTest.py
It tests your model to make sure it implements all the basic that could lead to issues. As it points out failures you can look at the test and adjust your model to properly handle each test. Usage would be like this: myModel = listbuild.SceneGraphModel() test = ModelTest.ModelTest(myModel) # exceptions will be raised when tests fail On Fri, Oct 25, 2013 at 9:06 PM, Bay <[email protected]> wrote: > Hi Justin, > thanks again for explaining to me. Another problem I've > been having with understanding pyQT is handling the error from .isValid(). > As I am just working from Yasin Uludag's tutorial codes I often just > attempt to modify the code with stopgap solutions that may not be the > proper way or efficient way of dealing with it because I do not understand > why the methods are setup the way they are. > > For example, I introduced a root parent into my model so that I could > parent all my later items under like so > > class SceneGraphModel(QtCore.QAbstractItemModel): > > def __init__(self, parent=None): > super(SceneGraphModel, self).__init__(parent) > self._rootNode=Node(None). > > However, if I attempted a self.model.rowCount(self.model._rootNode), which > should give me 0 when queried before I add in any rows I get a : > > AttributeError: 'Node' object has no attribute 'isValid' > > I want to get a rowCount() off this particular parent because when I want > to insert new rows which are entered at the end of the row list, rather > than at the begining if I do it manually. What should be the proper way of > creating a main root parent? > > Thank you > Gann Boon Bay > > -- > 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/186acaf1-ff52-45c8-8751-00f402ba9424%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/CAPGFgA2Mur44cQwTbYB4rdtnUq35coqKfweYS3xwb2hMmp6Qrg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
