<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you H-P & Florian.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">First, my apologies Florian, I got confused, I mistook your name for Phil Thompson's! I have cc'ed this now to him too :)</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Not only am I new to PyQt, but to Python too. I had only just clicked that the reason for these extra return values is that they are Reference/VAR parameters in the C++ (which I hadn't particularly noticed). Do you mean, Python does not have these, you have to return these Tuples in the return result as a way of achieving the same effect? OMG, it's just horrible... :)</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">OK, at least I see the reason. It's pretty hard to spot in the Qt documentation, you have to check out the presence of <span style="font-family:monospace,monospace">&</span>s (but not with <span style="font-family:monospace,monospace">const</span>, of which there are a lot) and read the small print in the docs to see what's likely to be going on...</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">@Phil</div><div class="gmail_default" style="font-family:tahoma,sans-serif">If you are the developer, documenter, may I ask you then:</div><div class="gmail_default" style="font-family:tahoma,sans-serif">1. Could this be noted against the declaration in the <span style="font-family:monospace,monospace">.pyi</span> file?</div><div class="gmail_default" style="font-family:tahoma,sans-serif">2. If not, should a PyQt overall document explain about this C++ -> Python conversion behaviour?</div><div class="gmail_default" style="font-family:tahoma,sans-serif">3. OOI, why does PyQt5 <span style="font-family:monospace,monospace">QFileDialog.getOpen/<wbr>SaveFileName()</span> return that second parameter? Lemme guess: it's the <span style="font-family:monospace,monospace">QString *selectedFilter</span> parameter, isn't it? The user can change that, and Qt returns it as well as the filename, I guess, though I can't even see that in the Qt documentation... Grrrrr!!<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 27 November 2017 at 16:40, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<span class=""><br>
On Mon, Nov 27, 2017 at 03:53:28PM +0000, J Barchan wrote:<br>
> [Also cc'ed to "Florian Bruhin", as I believe you have indicated that you<br>
> are "The Man"!]<br>
<br>
</span>I'm just a "normal" user of PyQt ;-)<br>
<br>
Phil Thompson is "the man", but as mentioned on [1], this mailing list is the<br>
right place to ask :)<br>
<br>
[1] <a href="https://www.riverbankcomputing.com/support/help" rel="noreferrer" target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>support/help</a><br>
<span class=""><br>
> I'm getting a little peeved by the problems which arise when you seem to<br>
> have chosen to make a PyQt function differ somewhat (in return result, so<br>
> far) from the corresponding Qt C++ function, but no documentation to<br>
> explain can be found. (This may apply only to PyQt5, not PyQt4, I don't<br>
> know.)<br>
><br>
> I was just trying to write an override in my own class for<br>
</span><span class="">> QRegularExpression.validate(). The Qt documentation (<br>
> <a href="http://doc.qt.io/qt-5/qregularexpressionvalidator.html#validate" rel="noreferrer" target="_blank">http://doc.qt.io/qt-5/<wbr>qregularexpressionvalidator.<wbr>html#validate</a>) shows:<br>
><br>
> QValidator::State <<a href="http://doc.qt.io/qt-5/qvalidator.html#State-enum" rel="noreferrer" target="_blank">http://doc.qt.io/qt-5/<wbr>qvalidator.html#State-enum</a>><br>
> QRegularExpressionValidator::<wbr>validate(QString<br>
</span>> <<a href="http://doc.qt.io/qt-5/qstring.html" rel="noreferrer" target="_blank">http://doc.qt.io/qt-5/<wbr>qstring.html</a>> &*input*, int &*pos*) const<br>
<span class="">> So I expect it to return a QValidator.State. However, QtGui.pyi shows:<br>
><br>
> def validate(self, input: str, pos: int) -><br>
> typing.Tuple[QValidator.State, str, int]: ...<br>
><br>
> So this is a tuple, with an extra str & int returned.<br>
><br>
> Apart from the fact that it's a tuple instead of a plain enum returned, I<br>
</span>> have *no idea* what the extra str & int might be, what to do with them, etc.<br>
<br>
Probably the fixed input and new position.<br>
<br>
> If you *really* need to return different information from the C++ function<br>
<span class="">> (why? to do with overloading not working the same??)<br>
<br>
</span>Because C++ can write a new value back to input/pos (because they're passed as<br>
reference), but Python can't.<br>
<span class="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><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="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>