[PySide] What can be returned from a slot?

Yann Lanthony yann.lanthony at gmail.com
Sun Jan 13 14:41:37 CET 2013


Indeed, "QVariant" is not necessary and setting the result type to QObject
works, thanks for the info.


2013/1/13 Yosef Meller <yosefmel at post.tau.ac.il>

> **
>
> 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 at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130113/2ba22878/attachment.html>


More information about the PySide mailing list