On Sunday 13 January 2013 14:32:10 Aaron Richiger wrote: > I think, this question is related to an earlier one from me... Anatoly > then told me the truth about lifetimes of QObjects that are created in > methods without any parent reference. They won't survive such a method > call as you try to do. By giving your model a parent reference that > survives the method call, the model will be available as well after the > return statement. The following code also shows, that the "QVariant" > trick is not necessary, but setting the result type to QObject is > enough. I hope this helps...
You're right, QVariant isn't necessary, only parenting. It's not very significant though as it only appears in the slot declaration. BTW, I see in your code that the model's rowCount method is declared as a slot. What is the value in that? Does anything use this? I'm sure it's optional because it works without it, but is it generally helpful to declare it a slot anyway? Yosef.
_______________________________________________ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside