<div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><span class="gmail-im">[sending again as I forgot to reply to the list]</span></div><div class="gmail_quote"><span class="gmail-im"><br></span></div><div class="gmail_quote"><span class="gmail-im">> is that about right (it does seem to work)?<div><br></div></span><div>Seems right.</div><div>The "name" argument of signals is not required as long as you use the same name for the attribute.<br></div><div><br></div><span class="gmail-im"><br>> Right?  And then how do I emit that signal?  Is it like:<br>> styledItemDelegate.editStarted.connect(lambda: self.editStarted.emit(someItemWidget))<br>> Is that use of a lambda right (that's a Python/PyQt question)?<br>> And how do I get at from within the QListWidget which QListWidgetItem to pass as someItemWidget (that's probably a Qt question)?<br></span></div><div class="gmail_quote"><br></div><div class="gmail_quote">Not exactly. If you need to pass an argument to a function within a lambda, it has to be in the lambda arguments too, otherwise python will try to look for the argument name in the local scope and eventually raise an error if it doesn't exist.<br><br></div><div class="gmail_quote">Seeing your implementation I'd modify the original editStarted signal of the delegate and add a QModelIndex argument:</div><div class="gmail_quote"><span style="color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt;white-space:pre-wrap"><br></span></div><div class="gmail_quote"><span style="color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt;white-space:pre-wrap">    editStarted = QtCore.pyqtSignal(QtCore.QModelIndex)</span><br></div><div class="gmail_quote"><div><br></div><div>then emit the signal from the setEditorData method with its index argument:</div><div><br></div><div><span style="color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt;white-space:pre-wrap">    self.editStarted.emit(index)</span></div><div><br></div><div>At this point you can connect it with this lambda in the QListWidget init:</div><div><br></div><div><font face="monospace, monospace"><span class="gmail-m_6120096286345341624gmail-m_-4564268010607243926gmail-hljs-selector-tag" style="white-space:pre-wrap">    styledItemDelegate</span><span class="gmail-m_6120096286345341624gmail-m_-4564268010607243926gmail-hljs-selector-class" style="white-space:pre-wrap">.editStarted</span><span class="gmail-m_6120096286345341624gmail-m_-4564268010607243926gmail-hljs-selector-class" style="white-space:pre-wrap">.connect</span><span style="white-space:pre-wrap">(</span><span class="gmail-m_6120096286345341624gmail-m_-4564268010607243926gmail-hljs-selector-tag" style="white-space:pre-wrap">lambda index</span><span style="white-space:pre-wrap">: </span><span class="gmail-m_6120096286345341624gmail-m_-4564268010607243926gmail-hljs-selector-tag" style="white-space:pre-wrap">self</span><span class="gmail-m_6120096286345341624gmail-m_-4564268010607243926gmail-hljs-selector-class" style="white-space:pre-wrap">.editStarted</span><span class="gmail-m_6120096286345341624gmail-m_-4564268010607243926gmail-hljs-selector-class" style="white-space:pre-wrap">.emit</span><span style="white-space:pre-wrap">(self.itemFromIndex(index))</span></font><br></div><div><br></div><div>In this way the the lambda will receive the index argument previously emitted, convert it to a list widget item and finally emit its own editStarted signal with the correct list widget item argument.</div><div><br></div><div>Regards,</div><div>Maurizio</div></div></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div></div>