<div dir="ltr">I read recently in an exchange between Florian and Phil that: <div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:"Courier New";color:black"><font size="1">The main purpose of pyqtSlot is to define a new entry in the
QObject's QMetaObject, so you would normally only use it on a method. pyqtSlot
doesn't check that the containing class is a QObject because it might be being
used as a mixin. When the connection is made the receiver must be a QObject.</font></span></blockquote><p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New";color:black"><br></span></p>In our code, we wrap slots so that we can customize error handling, so in a couple places we have code like this: <p class="MsoNormal"><font color="#000000" face="Courier New"><span style="font-size:13.3333px"><br></span></font></p><p class="MsoNormal"><font color="#000000" face="Courier New"><span style="font-size:13.3333px">def slot_fixer(qobject_method):</span></font></p><p class="MsoNormal"><font color="#000000" face="Courier New"><span style="font-size:13.3333px"> def slot_wrapper():</span></font></p><p class="MsoNormal"><font color="#000000" face="Courier New"><span style="font-size:13.3333px"> ...do stuff...</span></font></p><p class="MsoNormal"><font color="#000000" face="Courier New"><span style="font-size:13.3333px"> qobject_method()</span></font></p><p class="MsoNormal"><span style="font-size:13.3333px;color:rgb(0,0,0);font-family:"Courier New""> return </span><span style="color:rgb(0,0,0);font-family:"Courier New";font-size:13.3333px">pyqtSlot()(slot_wrapper)</span><br></p><div><font color="#000000" face="Courier New"><span style="font-size:13.3333px"><br></span></font></div><p class="MsoNormal"><font color="#000000" face="Courier New"><span style="font-size:13.3333px">class Foo(QObject):</span></font></p><p class="MsoNormal"><span style="font-size:13.3333px;color:rgb(0,0,0);font-family:"Courier New""> def qobject_method(self):</span><br></p><p class="MsoNormal"><span style="font-size:13.3333px;color:rgb(0,0,0);font-family:"Courier New""> ....</span></p><p class="MsoNormal"><span style="font-size:13.3333px;color:rgb(0,0,0);font-family:"Courier New""> </span></p><p class="MsoNormal"><span style="font-size:13.3333px;color:rgb(0,0,0);font-family:"Courier New""> slot_qobject_method = slot_fixer(qobject_method)</span></p><br>I.e., the method wrapped is from a QObject-derived class, but what pyqtSlot "decorates" is a wrapper for this method. This seems to have been working fine in PyQt 5.3 and 5.5, were we just lucky? Is it safe in 5.7?</div><div> <div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font size="2" style="font-size:small">Oliver</font><div style="font-size:small"><font size="1">Open Source contributions: <a href="http://pubsub.sf.net/" style="color:rgb(17,85,204)" target="_blank">PyPubSub</a>,</font><span style="font-size:x-small"> </span><a href="https://github.com/schollii/nose2pytest" style="color:rgb(17,85,204);font-size:x-small" target="_blank">nose2pytest</a><span style="font-size:x-small">,</span><span style="font-size:x-small"> L</span><a href="http://lua-icxx.sf.net/" style="font-size:x-small;color:rgb(17,85,204)" target="_blank">ua-iCxx</a><span style="font-size:x-small">, </span><a href="http://iof.sf.net/" style="font-size:x-small;color:rgb(17,85,204)" target="_blank">iof</a></div><div style="font-size:small"><font size="1"><a href="http://stackoverflow.com/users/869951/schollii" style="color:rgb(17,85,204)" target="_blank">StackOverflow</a> contributions</font></div></div><div><font size="1"><br></font></div><div></div></div></div></div></div></div></div>
</div></div>