Obsolete Members for QSocketNotifier

QSocketNotifier 类的以下成员已被废弃。提供这些成员是为了确保旧源代码能够继续运行。我们强烈建议不要在新代码中使用它们。

信号

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

注意:这是一个 私有信号。它可用于信号连接,但用户无法触发该信号。

成员函数文档

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

自 5.15 版本起,该函数已被废弃。我们强烈建议不要在新代码中使用它。

为避免描述符被意外截断,请使用该函数的 QSocketDescriptor 重载版本。若需与 5.15 之前的版本保持兼容,当插槽当前接受 int 类型时,需将其修改为接受 qintptr 类型,然后使用基于函数体的连接方式进行连接。

每当套接字通知器启用且发生了与其 `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()。

© 2026 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.