PyQt6 v6.12.0 stubs - positional-only parameters missing "/"

Grzegorz Bokota g.bokota at mimuw.edu.pl
Fri Oct 16 14:31:30 BST 2026


pt., 16 paź 2026 o 15:14 Phil Thompson <phil at riverbankcomputing.com>
napisał(a):

> On 16/10/2026 13:45, Grzegorz Bokota wrote:
> > Will the solution also contain also change of naming in type stubs to
> > not
> > use a0, a1 etc but use proper descriptive names like "watched" and
> > "event"
> > from Qt documentation?
> > https://doc.qt.io/qt-6/qobject.html#eventFilter bool
> > QObject::eventFilter(QObject *watched, QEvent *event)
>
> They will continue to use generated names but the arguments will be
> positional only so the names will never be used.


Thanks, change of name will benefit in more readable documentation, but it
still could depend more on just qt6 documentation.


> > Is it also possible to stop providing annotations like QObject | None
> > for
> > call parameters, even if Qt documentation suggests that it can't be
> > None
> > (also when checking PySide6 documentation, they provide plan QObject)?
> > I see that it comes from Qt convention to pass objects as pointers, not
> > references, but in reality I don't seen calling an event handler with
> > None
> > in place of Event. But type checkers still complain that the None case
> > is
> > not supported, which leads to writing obsolete code.
>
> I don't understand that last sentence. The stubs reflect the
> implementation and the Qt API allows you to pass None/NULL, whether or
> not it's a good idea. The /DisallowNone/ argument annotation can be used
> but that requires every call to be analysed individually.


Does Qt itself support of `QWidget::mouseMoveEvent` with a null pointer?
I might have got  such an event trigger in my Qt application?


> Phil
>

Regards,
Grzegorz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20261016/45205122/attachment.htm>


More information about the PyQt mailing list