Obsolete Members for QSocketNotifier

QSocketNotifier 的以下成员已被弃用。提供这些成员是为了保持旧源代码的正常运行。我们强烈建议不要在新代码中使用它们。

信号

(deprecated) void activated(int socket)[see note below]

注意: 这是一个私有信号。它可以在信号连接中使用,但不能由用户发出。

成员函数文档

[private signal, deprecated] void QSocketNotifier::activated(int socket)

该函数已被弃用。我们强烈建议不要在新代码中使用它。

为避免描述符被意外截断,请使用该函数的 QSocketDescriptor 重载。如果需要与早于 5.15 的版本兼容,则需要将槽改为接受 qintptr(如果当前接受的是 int),然后使用基于函数的连接进行连接。

每当启用套接字通知器,并发生与type 对应的套接字事件时,就会发出该信号。

套接字标识符通过socket 参数传递。

注意: 这是一个私有信号。可以在信号连接中使用,但用户不能发出。

注: 此信号已被重载。要连接到此信号,请参阅 "连接":

// Connect using qOverload:
connect(socketNotifier, qOverload(&QSocketNotifier::activated),
        receiver, &ReceiverClass::slot);

// Or using a lambda:
connect(socketNotifier, qOverload(&QSocketNotifier::activated),
        this, [](int socket) { /* handle activated */ });
有关更多示例和方法,请参阅连接重载信号

另请参阅 type() 和socket()。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.