<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 July 2018 at 11:47, Florian Bruhin <span dir="ltr"><<a href="mailto:me@the-compiler.org" target="_blank">me@the-compiler.org</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">Hey,<br>
<br>
On Thu, Jul 12, 2018 at 11:07:41AM +0100, J Barchan wrote:<br>
> Either way, if I do *not* specify <div style="font-family:tahoma,sans-serif;display:inline" class="gmail_default"></div>WA_DeleteOnClose I want to delete it<br>
<span class="gmail-">> explicitly when I'm done reading its values or whatever. In C++ I'd call<br>
> delete explicitly. What should I do from PyQt/Python? del??<br>
> .deleteLater()??<br>
<br>
</span>I just use obj.deleteLater(). There's also sip.delete(obj) if you really<br>
need something gone immediately, but I almost never use that.<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
Florian<br>
<br>
-- <br>
<a href="https://www.qutebrowser.org" rel="noreferrer" target="_blank">https://www.qutebrowser.org</a> | <a href="mailto:me@the-compiler.org">me@the-compiler.org</a> (Mail/XMPP)<br>
GPG: 916E B0C8 FD55 A072 | <a href="https://the-compiler.org/pubkey.asc" rel="noreferrer" target="_blank">https://the-compiler.org/<wbr>pubkey.asc</a><br>
I love long mails! | <a href="https://email.is-not-s.ms/" rel="noreferrer" target="_blank">https://email.is-not-s.ms/</a><br>
</font></span></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div style="font-family:tahoma,sans-serif" class="gmail_default">Thanks, Florian, I'll give <span style="font-family:monospace,monospace">deleteLater()</span> a go and test.</div><div style="font-family:tahoma,sans-serif" class="gmail_default"><br></div><div style="font-family:tahoma,sans-serif" class="gmail_default">Let me ask you one other question. I have a lot of these to deal with. I <i>suspect</i> that some of those which do not presently pass <div style="display:inline" class="gmail_default"></div><span style="font-family:monospace,monospace">WA_DeleteOnClose</span> to the constructor do not actually access the dialog after <span style="font-family:monospace,monospace">exec()</span>. <i>All</i> my dialogs are derived from my own base class. For simplicity/clarity, I'd like to make my base class unconditionally call <span style="font-family:monospace,monospace">super().__init__(parent, Qt.WA_DeleteOnClose)</span>. Then those callers which do <i>not</i> want auto-delete can explicitly go <span style="font-family:monospace,monospace">self.setWindowFlags(self.windowFlags() & ~Qt.WA_DeleteOnClose)</span> immediately <i>after</i> construction. I think this will give easiest default behaviour for my code. The question is: is it OK to switch off <span style="font-family:monospace,monospace">WA_DeleteOnClose</span> after construction, or do you think there is something which needs to know about this flag at construction-time only, and afterward is too late to switch off??<br></div><br><br clear="all"><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></div>