Qt 6.1 的新功能

Qt 6.1 中的新模块和恢复模块

Qt 6.1 添加了下列模块:

Active Qt 模块

Active Qt 提供 ActiveX 和 COM 支持,让 Qt for Windows 开发者:

  • 在 Qt 应用程序中访问和使用由任何 ActiveX 服务器提供的 ActiveX 控件和 COM 对象。
  • 使 Qt 应用程序可用作 COM 服务器,采用任意数量 Qt 对象和小部件作为 COM 对象和 ActiveX 控件。

Qt Charts 模块

Qt Charts 仍只支持 OpenGL 加速系列 ( AbstractSeries .useOpenGL)。此类系列不会在 Qt Quick 中渲染,若使用其它图形 API 进行渲染。

Qt Data Visualization 模块

Qt Data Visualization only supports the OpenGL RHI backend, and requires setting of the environment variable QSG_RHI_BACKEND to opengl . This can either be done at the system level, or defined in the application's main() with qputenv("QSG_RHI_BACKEND", "opengl"); .

Qt 设备实用程序模块

仅支持网络功能。

Qt Lottie 模块

The Qt Lottie Animation 模块已移植到 Qt 6 和 CMake 构建系统。

Qt SCXML 和 Qt StateMachine

Qt State Machine contains APIs that were part of Qt Core in Qt 5. The Qt State Machines package in the installer contains both the Qt SCXML and Qt State Machine 模块。

Qt Virtual Keyboard 模块

The Qt Virtual Keyboard 模块已移植到 Qt 6 和 CMake 构建系统。

  • A new dictionary manager allows user defined dictionaries (e.g. phone book) to be implemented by the application.
  • There are new properties in VirtualKeyboardSettings .
  • Support is added for Cerence Handwriting (T9 Write) and XT9.

Qt 6.1 的新特征

Qt Core 模块

Qt Gui 模块

  • QColorSpace can now set custom transfer-functions as tables.
  • QTextDocument now lets you to set a resource provider function, instead of sub-classing QTextDocument and overloading loadResource().
  • The Vulkan API wrappers ( QVulkanFunctions , QVulkanDeviceFunctions ) now expose the Vulkan 1.1 and 1.2 core APIs as well.
    • With relevant new functionality (supportedApiVersion()) added to QVulkanInstance to allow querying the supported instance-level version before instance creation.
  • 添加 QPainter::VerticalSubpixelPositioning hint. This is currently only supported on the Freetype font backend, and when available it will enable subpixel positioning of text in vertical direction at the expense of some memory and additional work. For most use cases, this should be left off, but it can be useful for very specific cases where you want to align painted elements vertically on a dynamically transformed painter.

Qt Widgets 模块

Qt Network 模块

  • QNetworkCookie 现在支持 SameSite 特征。
  • 引入 QNetworkInformation :
    • QNetworkInformation currently exposes the reachability of the system, using system API.
    • Currently supports Darwin, Windows, Android, and NetworkManager on Linux.
  • TLS backends, powering QSslSocket and related QSsl classes, were converted to plugin-oriented design.
    • Public and private classes in the 'ssl' sub-module of QtNetwork are now TLS implementation neutral and are not exposed to low-level APIs/details.
    • Existing TLS-backends (OpenSSL, SecureTransport, Schannel) now report which classes, features and protocols they support.
    • It's possible (for an application, using Qt) to provide its own backend to be used by QSslSocket and related classes.

Qt Qml 模块

  • 添加 QJSPrimitiveValue and QJSManagedValue for a more fine-grained control over JavaScript execution than it was possible with QJSValue alone.
  • The qt6_add_qml_module CMake function (still in Tech Preview) adds a qmllint target, which runs qmllint on the target's QML files.

Qt Quick 3D 模块

  • Technology preview: "Instanced Rendering", an optimized way of drawing multiple instances of the same objects with different transformations. This feature is considered feature-complete, but may still undergo minor API changes based on user feedback. It is planned for finalization in Qt 6.2.
  • Technology preview: 3D Particles, an API for adding particle effects to 3D scenes. This API is ready for testing, but is not yet feature-complete.
  • Qt Quick 3D now supports morph target animations, i.e. animations where all vertices interpolate between two sets of positions, giving the impression that one shape is morphing into another.

Qt 5 Compatibility 模块

While Qt Graphical Effects does not ship with Qt 6, a number of effects have been ported to the new graphics architecture and added to the Qt5Compat module. For example, to gain access to DropShadow , add the QML import Qt5Compat.GraphicalEffects . Some complex effects that rely on dynamic shader generation, such as a number of blur variants, have been removed.

API 变化列表

这些页面包含 Qt 6.1 的 API 变化概述: