[PySide] sender().data() does not work for custom objects

Frank Rueter | OHUfx frank at ohufx.com
Thu Nov 14 21:04:33 CET 2013


oops, yeah, that is not a good look. I already had the toolData 
attribute in place, just forgot to remove the data one, thanks for 
pointing that out.

The problem persists though. Any takers? Might throw it up on 
stackoverflow as well...



On 14/11/13 22:39, S. Champailler wrote:
> I can reproduce that.. Note that in your code setting the data 
> attribute in TestItem shadows the data method in the same class (I 
> think).
> Stefan
>
> Le 14 novembre 2013 à 04:54, Frank Rueter | OHUfx <frank at ohufx.com> a 
> écrit :
> > Hi all,
> >
> > I'm trying to make a QAction pass a custom object as it's data, so I 
> can
> > grab it via QWidget.sender().data()
> > This works just fine for a default object like a dictionary, but not 
> for
> > a custom object that I need to use.
> >
> > This works fine in PySide 1.0.9 but PySide 1.2.1 always returns None
> > when querying sender().data() from a QAction that has a custom object
> > assigned to it's data.
> >
> > Here is some sample code that shows the problem:
> > http://pastebin.com/pT7KJ4Uf
> >
> >
> > Is this a bug in PySide 1.2.1 or did I do something wrong before which
> > accidentally worked in PySide 1.09 when it shouldn't have?
> >
> >
> > Cheers,
> > frank
> > _______________________________________________
> > 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/20131115/5fa37c89/attachment.html>


More information about the PySide mailing list