Deprecated QScoketNotifier::activated signal overload

Florian Bruhin me at the-compiler.org
Mon Mar 20 16:52:02 GMT 2023


On Mon, Mar 20, 2023 at 04:21:46PM +0000, Phil Thompson wrote:
> 
> On 17/03/2023 17:36, Florian Bruhin wrote:
> > Hey,
> > 
> > When connecting to a QSocketNotifier's activated signal, it looks like
> > PyQt insists on using the deprecated variant:
> > 
> > QSocketNotifier::activated(int socket)
> > https://doc.qt.io/qt-6/qsocketnotifier-obsolete.html#activated-1
> > 
> > Rather than using the new replacement (since Qt 5.15):
> > 
> > QSocketNotifier::activated(QSocketDescriptor socket,
> > QSocketNotifier::Type type)
> > https://doc.qt.io/qt-6/qsocketnotifier.html#activated
> > 
> > [...]
> 
> I didn't implement the newer signal because of the undocumented
> QSocketDescriptor class. I have a general rule that if something isn't
> documented then it's not part of the public API.

It looks like it is documented in the source:
https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qsocketnotifier.cpp?h=v6.4.3#n338

Why it doesn't end up in the generated documentation is beyond me.

> Why specify QSocketDescriptor when QSocketNotifier uses qintptr to
> represent a socket?
> The whole thing had a bad smell.

From what I understand, the issue is that the socket Qt::HANDLE can be
64bit on Windows, but gets truncated to a 32bit int (and not a qintptr)
in the signal:

https://bugreports.qt.io/browse/QTBUG-70441
https://codereview.qt-project.org/c/qt/qtbase/+/294902

> Is the loss of the second argument a problem?

Not for me - the truncation of the socket *might* be, but then again,
I can't say I actually ran into trouble in practice so far. I mostly
happened to see the deprecation warning and thought I'd mention it,
since PyQt's policy seemed to be to not use/expose deprecated API where
possible.

Florian

-- 
            me at the-compiler.org | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
             I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20230320/d1d41f84/attachment.sig>


More information about the PyQt mailing list