<div dir="ltr"><div>Some time ago I realized that the QPdfView and QPdfDocument classes [re]introduced since Qt6.4 have the parent argument as mandatory, even if a real parent is actually required (using None is perfectly valid).</div><div>I've never used these objects, except for knowledge purposes, so I didn't mind too much.<br></div><div><br></div><div>Yesterday I came across this SO post: <a href="https://stackoverflow.com/q/77692836/2001654">https://stackoverflow.com/q/77692836/2001654</a></div><div><br></div><div>In this case the problem becomes more important: using QPdfView as a promoted widget in Designer results in a TypeError because the parent argument is keyworded, but even if the positional named argument is still "parent", it's not recognized as a standard python function would.</div><div><br></div><div>I know that the issue mostly comes from the "wrong signature" in Qt and PyQt just does what its implementation is expected to do, and I also filed a report (<a href="https://bugreports.qt.io/browse/QTBUG-120313">QTBUG-120313</a>).</div><div><br></div><div>In the meantime, I proposed a couple of possible workarounds: patching instantiate() in qobjectcreator.py, or using a custom QPdfView subclass as a promoted widget instead of the default one.</div><div><br></div><div>Still, I'd like to know the exact reason for which the parent argument isn't accepted if keyworded, since the apparent signature should allow that. I know that PyQt classes do some "magic" under the hood whenever a new instance is created, but I'm curious about these aspects and the difference with the normal, expected behavior.</div><div><br></div><div>I'd also suggest to provide an official fix for this issue, considering that there's no guarantee that the Qt class constructors will be fixed anytime soon (and there would still be problems with previous Qt versions).</div><div>Nonetheless, I realize that "officially" fixing this may be difficult or inconsistent and would potentially break some aspects (even semantically), in that case a note in the "Using Designer" documentation should probably be added.<br></div><div><br></div><div>Thank you,</div><div>MaurizioB<br></div><div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="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></div>