<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 25, 2016 at 11:15 AM, triccare triccare <span dir="ltr"><<a href="mailto:triccare@gmail.com" target="_blank">triccare@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span style="font-size:12.8px">This is quite interesting... If you add a traceback.print_stack()</span><br style="font-size:12.8px"><span style="font-size:12.8px">here:</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">>     def __iter__(self):</span><br style="font-size:12.8px"><span style="font-size:12.8px">>         for row in range(self.rowCount()):</span><br style="font-size:12.8px"><span style="font-size:12.8px">>             yield self.child(row)</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">It seems like it gets called when doing model.appendRow(li).</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">Looking at Qt's documentation, QStandardItemModel::appendRow can be</span><br style="font-size:12.8px"><span style="font-size:12.8px">called with a QStandardItem, or a list of QStandardItems. I'm guessing</span><br style="font-size:12.8px"><span style="font-size:12.8px">since your custom class implements __iter__, it's treated like a list</span><br style="font-size:12.8px"><span style="font-size:12.8px">of QStandardItems (because how would PyQt know the difference</span><br style="font-size:12.8px"><span style="font-size:12.8px">otherwise?)</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">Florian</span></div></blockquote><div><br></div><div>Hmmm, if PyQt4 looked specifically for a QList or type(list), but now PyQt5 just looks for "list-like", that could be the explanation. Hard to tell where the check would be in the interface between python and C.</div><div><br></div><div>Cleverness foiled by others' cleverness.</div></div></div></div>