[PyQt] Issue with PyQt5.6 wheel on OS X with QGraphicsItemGroup addToGroup

Nick a.grinner at gmail.com
Tue Jun 21 20:02:34 BST 2016


I notice if I instrument the parent `itemChange`, the
`QGraphicsItem.ItemChildAddedChange`
value in the parent comes in as a `PyQt5.QtWidgets.QGraphicsItem` and not a
`MyRectItem`.

Could this be related to changes to SIP, qvariant.sip or
Chimera::parse_py_type?

Again this is a platform independent problem.

-Nick

On Mon, Jun 20, 2016 at 1:25 PM, Nick <a.grinner at gmail.com> wrote:

> I've reproduced this bug also on Windows x64 in PyQt 5.6.  It is related
> to subclassed QGraphicsItems who have `itemChange()` implemented.  Here is
> the code that reproduces the bug I see and that produces different results
> in PyQt5.5.1 and prior (and worked in PyQt4 as well for what it's worth)
> with and without itemChange() implemented in the subclass.  Output appears
> at the bottom.
>
> from PyQt5.QtWidgets import QGraphicsItem, QGraphicsRectItem,
> QGraphicsItemGroup
>
> class MyItemGroup(QGraphicsItemGroup):
>     def __init__(self, parent=None):
>         super(MyItemGroup, self).__init__(parent)
>
>     def __repr__(self):
>         return str(type(self).__name__)
>
> class MyRectItemNOIC(QGraphicsRectItem):
>     def __init__(self, parent=None):
>         super(MyRectItemNOIC, self).__init__(parent)
>
>     def __repr__(self):
>         return str(type(self).__name__)
>
>
> class MyRectItem(QGraphicsRectItem):
>     def __init__(self, parent=None):
>         super(MyRectItem, self).__init__(parent)
>
>
>     def __repr__(self):
>         return str(type(self).__name__)
>
>     def itemChange(self, change, value):
>         return QGraphicsRectItem.itemChange(self, change, value)
>
> if __name__ == '__main__':
>     a = MyRectItem()
>     b = MyRectItem(a)
>     item_group = MyItemGroup()
>
>     print("parent:", b.parentItem())
>     item_group.addToGroup(b)
>     print(item_group.childItems(), b.parentItem())
>
>     c = MyRectItemNOIC(a)
>     print("\nparent NOIC:", c.parentItem())
>     item_group.addToGroup(c)
>     print(item_group.childItems(), c.parentItem())
>
>
> Output:
>
> parent: MyRectItem
> [] None
>
> parent NOIC: MyRectItem
> [MyRectItemNOIC] MyItemGroup
>
>
> On Thu, Jun 16, 2016 at 2:25 PM, Nick <a.grinner at gmail.com> wrote:
>
>> I've compared PyQt-gpl-5.5.1-snapshot-13f9ece29d02 code with the PyQt-gpl-5.6
>> code and see no difference nor in the Qt 5.3 and 5.6 qgraphicsitem.cpp.
>>
>> Could this be a sip regression I'm seeing?
>>
>> In general everything about the 5.6.x builds and execution seems normal
>> in my code except this addToGroup issue I see with custom objects.
>>
>> the problem persists in PyQt-gpl-5.6.1-snapshot as well when I build
>> from source.
>>
>> In summary on OS X:
>>
>> Python 3.5 with PyQt5.5.1 works
>> Python 3.5 with PyQt5.6.1-snapshot fails to addToGroup()
>> Python 3.5 with PyQt5.6.0 fails
>> Python 3.4 with PyQt5.5.1 works
>>
>> I can work on a simple case reproduction if that helps as well.
>>
>> -Nick
>>
>> On Wed, Jun 15, 2016 at 7:41 PM, Nick <a.grinner at gmail.com> wrote:
>>
>>> Actually my code works as of a build of
>>> PyQt-gpl-5.5.1-snapshot-13f9ece29d02
>>>
>>> Thanks,
>>>
>>> -Nick
>>>
>>> On Wed, Jun 15, 2016 at 7:29 PM, Nick <a.grinner at gmail.com> wrote:
>>>
>>>> I have working code that I can run in a self built PyQt5.3 build that
>>>> ceases to work in the wheel from pypi of PyQt5.6 for OS X.  Specifically
>>>> addToGroup() fails.  Did something change in the Qt5.x or PyQt5.x source
>>>> from 5.3 to 5.6 related to this that anyone is aware of?
>>>>
>>>> In 5.6 when I call addToGroup of subclassed QGraphicsItem, the
>>>> parentItem of the Item becomes None and therefore calls to
>>>> group.childItems() return an empty list, whereas with no code changes in
>>>> the 5.3 I built the calls behave as intended.
>>>>
>>>> I have not yet tested on Windows.
>>>>
>>>> Thanks,
>>>>
>>>> -Nick
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160621/39ac3e4f/attachment.html>


More information about the PyQt mailing list