[PySide] sending QStandardItem() as QAction.data() yields None in receiving widget
Frank Rueter | OHUfx
frank at ohufx.com
Fri Mar 4 08:20:37 CET 2016
So a better workaround I just found is to write a custom action that
sends the required data via a custom signal like this:
class CustomAction(QAction):
customData = Signal(list)
def __init__(self, icon, text, parent):
super(CustomAction, self).__init__(icon, text, parent)
self.myData = []
self.triggered.connect(self.emitCustomSignal)
def setCustomData(self, data):
self.myData = data
def emitCustomSignal(self):
self.customData.emit(self.myData)
Seems to work as a band aid.
frank
On 3/03/16 9:59 pm, Frank Rueter | OHUfx wrote:
>
> Hi guys,
>
>
> I ran into this a while ago but since the host application I am using
> with my PySide apps was still using PySide 1.0.7 it wasn't a problem.
> Now it's being switched to use PySide 1.2.2 and the bug is back in sight.
>
> Below is a test snippet that shows how assigning a QStandardItem via
> QAction().setData() returns None when QAction().data() is called.
>
> Is this a known bug?
>
> I guess the work around is to send the data required to re-create the
> QStandardItem as a dictionary?!
>
>
> http://pastebin.com/E9TCgEfJ
>
>
> Cheers,
> frank
>
>
>
> --
> ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing
> <http://ohufx.com/index.php/vfx-compositing> | *workflow customisation
> and consulting <http://ohufx.com/index.php/vfx-customising>* *
>
>
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
--
ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing
<http://ohufx.com/index.php/vfx-compositing> | *workflow customisation
and consulting <http://ohufx.com/index.php/vfx-customising>* *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20160304/1e09a0da/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 2666 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20160304/1e09a0da/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ohufxLogo_50x50.png
Type: image/png
Size: 2666 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20160304/1e09a0da/attachment-0001.png>
More information about the PySide
mailing list