[PySide] What can be returned from a slot?
Yosef Meller
yosefmel at post.tau.ac.il
Sun Jan 13 14:40:15 CET 2013
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130113/653da56a/attachment.html>
More information about the PySide
mailing list