本页内容

变更说明Qt WebSockets

Qt 6 的改动,是出于让框架更高效、更易于使用的有意识努力。

我们努力在每次发布中保持所有公共 API 的二进制和源代码兼容性。但在致力于将 Qt 打造为更优秀的框架的过程中,某些变更在所难免。

在本主题中,我们总结了Qt WebSockets 中的这些变更,并提供了相应的处理指南。

破坏性公共 API 变更

本节包含有关破坏源代码兼容性的 API 变更的信息。

QWebSocketServer::socketDescriptor()、QWebSocketServer::setSocketDescriptor()

在 Qt 6 中,您应使用QWebSocketServer::socketDescriptor() 和QWebSocketServer::setSocketDescriptor() 来访问底层的qintptr 类型的套接字描述符。它们与QTcpServer::socketDescriptor() 和QTcpServer::setSocketDescriptor() 功能一致,并取代了现已弃用的 nativeDescriptor() 和 setNativeDescriptor() 方法。

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