<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="gmail_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>