<div dir="ltr">Hi Jonathan,<div><br></div><div>You can connect a signal directly to another signal. So in your class definition:</div><div><br></div><div>editingFinished = pyqtSignal()</div><div><br></div><div>def __init__(self, ....):</div><div> .....</div><div> myLineEdit.editingFinished.connect(self.editingFinished)</div><div><br></div><div>Hope this helps,</div><div><br></div><div>Denis</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">Le mer. 17 janv. 2018 à 07:54, J Barchan <<a href="mailto:jnbarchan@gmail.com">jnbarchan@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">I inherited code using a <span style="font-family:monospace,monospace">QLineEdit</span>. I have to change that into a (what I call) a "composite" widget, consisting of a <span style="font-family:monospace,monospace">QWidget</span> which holds a <span style="font-family:monospace,monospace">QHBoxLayout</span> which in turn holds the original <span style="font-family:monospace,monospace">QLineEdit</span>, plus a <span style="font-family:monospace,monospace">QPushButton</span>; the button leads to something which can populate the <span style="font-family:monospace,monospace">QLineEdit</span>.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I'm OK with the design, apart from signal/slot handling. The outside world used to go <span style="font-family:monospace,monospace">QLineEdit.editingFinished.connect(...)</span>. To encapsulate, I'd like it to go <span style="font-family:monospace,monospace">CompositeWidget.editingFinished.connect(...)</span>, rather than addressing the <span style="font-family:monospace,monospace">QLineEdit</span> directly. So I want to simply "transfer" the <i>existing</i> <span style="font-family:monospace,monospace">editingFinshed</span> signal/slot from the <span style="font-family:monospace,monospace">QLineEdit</span> to the <span style="font-family:monospace,monospace">CompositeWidget</span> level, "transparently".</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">This is for PyQt 5 only, not earlier versions. So far I've never had to use PyQt <span style="font-family:monospace,monospace">@</span> annotations (<span style="font-family:monospace,monospace">@pySignal/Slot</span> or whatever they are), and I'm not sure I ought need to, given the definition in <span style="font-family:monospace,monospace">QLineEdit</span> in <span style="font-family:monospace,monospace">QtWidgets.pyi</span> is already as plain as <br clear="all"><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt"><span style="color:rgb(0,0,128);font-weight:bold">def </span>editingFinished(<span style="color:rgb(148,85,141)">self</span>) -> <span style="color:rgb(0,0,128);font-weight:bold">None</span>: ...</pre></div><div style="font-family:tahoma,sans-serif" class="gmail_default">So, given that I regard minimal code as neat/desired, what is like the <i>minimum</i> I need to write to achieve this? I will need the outside world to be able to <span style="font-family:monospace,monospace">connect()</span>, my widget needs to be able to <span style="font-family:monospace,monospace">emit()</span> it (when the user has finished interacting via the button, widget populates the <span style="font-family:monospace,monospace">QLineEdit</span> and needs that to raise <span style="font-family:monospace,monospace">editingFinished</span> signal to the outside world). I think that's it!<br></div><br>-- <br><div class="m_5461219028834821013gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><span style="font-family:tahoma,sans-serif">Kindest,</span></div><div><span style="font-family:tahoma,sans-serif">Jonathan</span></div></div></div></div></div>
</div>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></blockquote></div>