<div dir="ltr"><div>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.</div><div><br></div><div>from PyQt5.QtWidgets import QGraphicsItem, QGraphicsRectItem, QGraphicsItemGroup</div><div><br></div><div>class MyItemGroup(QGraphicsItemGroup):<br> def __init__(self, parent=None):<br> super(MyItemGroup, self).__init__(parent)</div><div><br></div><div> def __repr__(self):<br> return str(type(self).__name__)</div><div><br></div><div>class MyRectItemNOIC(QGraphicsRectItem):<br> def __init__(self, parent=None):<br> super(MyRectItemNOIC, self).__init__(parent)</div><div><br></div><div> def __repr__(self):<br> return str(type(self).__name__)</div><div><br></div><div><br>class MyRectItem(QGraphicsRectItem):<br> def __init__(self, parent=None):<br> super(MyRectItem, self).__init__(parent)</div><div><br></div><div><br> def __repr__(self):<br> return str(type(self).__name__)</div><div><br></div><div> def itemChange(self, change, value):<br> return QGraphicsRectItem.itemChange(self, change, value)<br></div><div><br></div><div>if __name__ == '__main__':<br> a = MyRectItem()<br> b = MyRectItem(a)<br> item_group = MyItemGroup()</div><div><br></div><div> print("parent:", b.parentItem())<br> item_group.addToGroup(b)<br> print(item_group.childItems(), b.parentItem())</div><div><br></div><div> c = MyRectItemNOIC(a)<br> print("\nparent NOIC:", c.parentItem())<br> item_group.addToGroup(c)<br> print(item_group.childItems(), c.parentItem())</div><div><br></div><div><br></div><div>Output:</div><div><br></div><div><div>parent: MyRectItem</div><div>[] None</div></div><div><br></div><div>parent NOIC: MyRectItem</div><div>[MyRectItemNOIC] MyItemGroup</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 16, 2016 at 2:25 PM, Nick <span dir="ltr"><<a href="mailto:a.grinner@gmail.com" target="_blank">a.grinner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I've compared <span style="font-size:13px">PyQt-gpl-5.5.1-snapshot-</span><span style="font-size:13px">13f9ece29d02 code with the </span><span style="font-size:13px">PyQt-gpl-5.6 code and see no difference nor in the Qt 5.3 and 5.6 qgraphicsitem.cpp. </span><div><span style="font-size:13px"><br></span></div><div>Could this be a sip regression I'm seeing? </div><div><br></div><div>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.<div><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">the problem persists in </span><span style="font-size:13px">PyQt-gpl-5.6.1-snapshot as well when I build from source.</span></div></div><div><br></div><div>In summary on OS X:</div><div><br></div><div>Python 3.5 with PyQt5.5.1 works</div><div>Python 3.5 with PyQt5.6.1-snapshot fails to addToGroup()</div><div>Python 3.5 with PyQt5.6.0 fails<br></div><div><span style="font-size:13px">Python 3.4 with </span>PyQt5.5.1 works</div><div><br></div><div>I can work on a simple case reproduction if that helps as well.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Nick</div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 15, 2016 at 7:41 PM, Nick <span dir="ltr"><<a href="mailto:a.grinner@gmail.com" target="_blank">a.grinner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Actually my code works as of a build of PyQt-gpl-5.5.1-snapshot-13f9ece29d02<div><br></div><div>Thanks,</div><div><br></div><div>-Nick</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 15, 2016 at 7:29 PM, Nick <span dir="ltr"><<a href="mailto:a.grinner@gmail.com" target="_blank">a.grinner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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?<div><br></div><div>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.</div><div><br></div><div>I have not yet tested on Windows.</div><div><br></div><div>Thanks,</div><div><br></div><div>-Nick</div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>