Qt 6.2 的新功能

Qt 6.2 中的新模块和还原模块

Qt 6.2 添加了下列模块:

Qt 6.2 reintroduces the following modules that were not present in Qt 6.1. All listed modules were ported to Qt 6 and the CMake build system.

A more detailed list of changes to each module can be found in Qt 6 中的 Qt 模块变化 .

  • Qt Bluetooth
    • BlueZ 4 支持被移除。
    • Win32 backend was removed. As a consequence, there is no longer support for Qt Bluetooth using MinGW.
    • 移除 QML API。
    • QBluetoothTransferManager 和相关类被移除。
    • Functionality related to pairing agents was removed from QBluetoothLocalDevice .
  • Qt Multimedia
    • Qt Multimedia public API consists of five large functional blocks. Each API has undergone significant changes compared to Qt 5:
      • 设备探索
      • 低电平音频
      • 回放和解码
      • 捕获和录制
      • 视频输出管道
    • 目前支持的后端:
      • Linux: GStreamer
      • Windows: WMF
      • macOS/iOS: AVFoundation
      • Android: MediaPlayer 和 Camera API
  • Qt NFC
    • 移除对 Linux/NearD 的支持。
    • 添加对 iOS 的支持。
  • Qt Positioning
    • Many of the properties were made bindable.
    • 重命名 QGeoPolygon::path() 为 QGeoPolygon::perimeter .
    • QGeoLocation 现在使用 QGeoShape 而不是 QGeoRectangle 作为边界区域。
    • The error() signal in multiple positioning classes was renamed to errorOccurred() .
    • QGeoPositionInfoSourceFactoryV2 was removed, and QGeoPositionInfoSourceFactory now supports custom parameters for the created objects.
    • NMEA support was redesigned. The serialnmea plugin was renamed to nmea and now supports reading the input stream from a TCP socket or a raw file. The nmeaSource property was removed.
  • Qt Remote Objects
    • The local connection backend now supports abstract namespaces (this is a Linux-specific extension), achieved by using the new localabstract schema in the URL.
    • .rep 文件现在支持:
      • 类枚举。
      • QFlags .
      • 多行注释 (C 样式)。
    • 枚举和 flags are now supported in POD-types and as keys for QMap and QHash properties in .rep 文件。
  • Qt Sensors
    • Most QML facing properties are now bindable.
    • Sensor::type and QSensor::type properties are now marked as constant.
    • Added parameter to QSensorBackend::sensorBusy () to be able to also clear the busy state.
    • 删除 typedef 为 qtimestamp。
    • 重命名传感器 type 字符串到 sensorType .
    • Windows: We can now require Windows 10 API, thereby extending the number of sensors supported.
    • TI Sensor Tag as supported platform has been removed.
    • Linux sysfs 后端已删除。
    • The sensor gesture support has been removed (input welcomed here: QTBUG-97066 ).
    • Sensorfw as a platform was removed due to Sensorfw itself not yet ported to Qt 6.
    • Sensor types that had only Sensorfw backend (IRProximity, Lid, and Tap) are not listed as supported anymore.
    • Sensor types without any backend have been removed (Altimeter, Distance, and Holster).
  • Qt Serial Bus
  • Qt Serial Port
  • Qt WebChannel
    • QWebChannel 特性变得可绑定。
    • The property update interval of QWebChannel can now be configured. 50ms update interval remains the default.
    • QWebChannel now supports property updates for BINDABLE properties. However, the client side does not provide a generic callback mechanism if the host property does not have a NOTIFY signal.
    • Signals from objects living in a different thread are now handled correctly ( QTBUG-51366 ).
  • Qt WebEngine
  • Qt WebSockets
  • Qt WebView

Qt 6.2 中的新特征

Qt Core 模块

  • 添加功能:
    • 添加 QByteArrayView::compare ().
    • 添加方法 QFlags::test(Any)Flag(s)。
    • 添加 QHashSeed to control hashing (seeds are now size_t); this shall replace qGlobalQHashSeed and qSetGlobalQHashSeed.
    • Added PRIxQTDATATYPE macros to facilitate printf()-style formatting without casts or warnings.
  • 使很多特性变得可绑定。
  • Grapheme clusters can now handle emojis.
  • UNC paths and network shares on Windows are now handled consistently.
  • The handling of the start-offset parameter, called from , in various indexOf() and lastIndexOf() methods of containers (principally QString , QByteArray and their views) is now more coherent.
  • QString::number () has since the release of Qt 6.0, QByteArray::number ()'s overloads for signed integral types now return a text with a minus sign followed by the number's absolute value instead of coercing to an unsigned type for all bases except ten, when passed a negative integer and any supported base.
  • QCalendar now supports construction from the ID of a custom backend.
  • QChar , QPoint ,和 QPointF are now primitive rather than merely relocatable.
  • QCoreApplication::exit () is now, like quit(), a slot (as the documentation long claimed); same for QEventLoop and QThread .
  • QDateTime now takes account of time-zones throughout time_t's range (in so far as the platform supplies such information), rather than artificially limiting the range to 1970 - 2037.
  • Fleshed out the value-type behavior of QFlags , and it is now used more systematically.
  • When building for C++20, QList (hence also QVector ) is now a contiguous_iterator , satisfying contiguous_range .
  • QLocalSocket::waitFor*() methods were made to support duplex operations on Windows (as they already did on Unix).
  • Added std::chrono overloads to QLockFile methods, avoiding needless conversions between UTC and local time.
  • QString can now be built from char8_t (when available).
  • Made QThreadPool 's thread priority configurable; the threads share the pool's name if it has one.
  • Lots of Bug-fixing, clean up, and documentation improvements.

Qt GUI 模块

  • Added floating point image formats to QImage for both 16-bit and 32-bit floats.
  • Converting RGB images to, or painting RGB colors onto, gray-scale images is now gamma corrected and produces the luminance values of the input color space.
  • CSS text-decoration-color attribute is now supported in rich text spans with underlines, overlines, and strikethrough.

Qt Quick 模块

Qt Quick Controls 模块

Qt Widgets 模块

Qt Network 模块

  • QSslSocket
    • TLS backends that were previously (in Qt 6.1) converted into plugin-like classes, were moved out of QtNetwork and implemented as real plugins.
    • Several TLS backends may now co-exist at runtime, for example, OpenSSL and Schannel, or OpenSSL and SecureTransport.
  • QNetworkInformation
    • 引入 isBehindCaptivePortal , a new property that can be used to determine whether the user is connected to a network with a captive portal.

Qt QML 模块

  • 核心语言
    • 添加支持可选链。
    • 添加 as casts: these mostly help tooling but can also be used to replace code such as return (obj instanceof Item) ? obj.width : 42 with (obj as Item)?.width ?? 42 .
  • Added a public CMake API for QML modules: qt_add_qml_module() .
    • 负责生成 qmldir and qmltypes .
    • Can automatically create a plugin if a plugin only registers types.
    • Has built-in support for a linting target.
  • QML tooling
    • qmllint
      • Added a granular setting for the warning severity; warnings can be disabled entirely, make them informational only, or make them lead to a non-zero exit code.
      • Added a settings file ( .qmllint.ini ) for configuring warning levels on a directory-by-directory basis. A default settings file can be generated using qmllint --write-defaults .
      • Warnings can now be disabled in blocks via comments; //qmllint enable/disable <warning-type1> <warning-type2...>
      • Greatly improved performance when linting files, especially when linting multiple files with lots of imports.
      • Added support for JSON output for use in tooling.
    • qmlformat
      • qmlformat now utilizes our new qmldom library and should generally produce better output.

Qt Quick 3D 模块

  • 添加支持 instanced rendering , an optimized way of drawing multiple instances of the same objects with different transformations.
  • Added 3D Particles, an API for adding particle effects to 3D scenes. This includes a technology preview of model blend particles.
  • Added Qt Quick Input events for 2D items in 3D, both in scene and in textures.
  • Added an API for ray-based picking from arbitrary points in the scene.
  • 添加 RuntimeLoader , making it possible to load glTF2 files at runtime.
  • 实现 parallax occlusion mapping : Enables the use of height maps without the cost of adding geometry.
  • 实现 depth draw mode on materials: Enables fine control over depth rendering for a material.

Qt Data Visualization 模块

  • 修复背景渲染模式。
  • RenderDirectToBackground_NoClear was deprecated as opting to not clear the window is no longer an option in Qt 6.
  • 许多次要 Bug 修复。

Qt Charts 模块

  • Added more marker shapes to pick from in QScatterSeries and QLegend .
  • 添加 light marker feature to QXYSeries and QLegend . This is a lighter weight rendering of points.
  • Added an ability to select points in a series via method calls to QXYSeries and QBarSet .
  • Added an ability to set a color or use a custom light marker to be used for selected points in QXYSeries .
  • Added an ability to set a color to be used for selected bars in QBarSet .
  • Added a feature to display a best fit line QXYSeries .
  • Added an ability to customize the look of individual points in a QXYSeries . This feature allows setting the visibility, label visibility, and the size of each point.
  • 添加方法 sizeBy () 到 QXYSeries that adjusts the size of the points in a series according to passed values.
  • 添加方法 colorBy () 到 QXYSeries that adjusts color of the points in a series according to passed values and a gradient.
  • Added a new axis class QColorAxis to support the colorBy() feature, displaying a color scale.
  • Added an ability to disable label truncation in axes.
  • Improved performance by caching recently used text bounds.
  • Added interactive support to QLegend via a setInteractive () method. Once enabled, allows the legend to be detached with a double-click. Once detached, the legend can be dragged and resized, and reattached to a side of the chart by dragging it off the edge.
  • 添加 attachedToChartChanged () 信号到 QLegend .
  • 更新图例范例。

Qt for Python

平台的变化

技术预览平台

ARM 中的 Windows

  • Added Windows on ARM64 as a technology preview platform.
  • Supported as a build target; no host support yet.
  • 已知局限性:
    • No support for Qt WebEngine yet; missing official support for Chromium.
    • No support for SSL yet; missing official OpenSSL support.

桌面平台

Apple Silicon 中的 macOS

  • Added official support as both a target and a host platform.
  • Libraries in the Qt SDK are built as universal binaries.
  • 已知局限性:

Linux 中的 Wayland 客户端

  • A touchpad pinch gesture now generates Zoom and Rotate QNativeGestureEvent s if the compositor sends them via the pointer-gestures-unstable-v1 protocol. This allows a Qt Quick PinchHandler to operate via touchpad pinch gestures. Two, three, or four-finger gestures are recognized. A gesture of type Qt::PanNativeGesture can be generated by swiping with three or four fingers. Two-finger flicking still generates QWheelEvent s as before.

移动平台

Android

  • Some of the methods previously under the QtAndroid namespace in QtAndroidExtras (for example, sdkVersion() and context()), were moved to QNativeInterface::QAndroidApplication .
  • Implemented a new permissions API in QCoreApplication .
  • The remaining QtAndroidExtras APIs were left as private APIs in qtbase until cross-platform alternatives (for Intents, Services, etc.) are in place.
  • Removed obsolete Ministro code as it's now unsupported by Android.
  • Simplified AndroidManifest.xml to only contain tags relevant to the user, helping maintainability and reducing clutter.
  • QCDebug() and friends now use the category as a tag in Android logcat .
  • Updated Android Gradle plugin to 4.1.3.
  • Fixed a non-SDK API bug with style ( QTBUG-71590 ), though Android Style for widgets on Android 9+ is still affected ( QTBUG-96149 ).
  • The default targetSdkVersion is set to 30 in accordance with Google Play Store requirements.
  • The build-tools version and platform version used is bumped to 30.
  • QDesktopServices custom handlers are now enabled, and allow you to work with Android App Links, for example.
  • Added information that allow applications to determine the source of an intent without creating an own extension of QtActivity.
  • Fixed imports for QML modules and added the possibility of multiple QML root paths.
  • Fixed Vulkan builds on Android.

iOS

  • 改进 CMake 支持。
  • 已知问题:
    • 缺少默认启动屏幕故事板。
    • 自定义库无法安装 ( QTBUG-95381 ).

嵌入式平台

可用于 Qt for Device Creation 许可。

Boot to Qt

  • The Boot to Qt stack was updated to use Yocto 3.3 (Hardknott).
  • Added Intel NUC10 (64bit i5 x86) as a reference target.
  • Added NVidia Jetson Tegra X2 as a target.

QNX

  • Added QNX version 7.1 and Ubuntu 20.04 as a host.
  • Added NXP iMX8QM as a reference target.

INTEGRITY

  • Added INTEGRITY version 19.0.13 and Ubuntu 20.04 as a host.
  • Added Qualcomm Snapdragon 8155P as a reference target.

WebOS

Qt 6.2 has been verified to work with LG webOS OSE 2.13.1 using Ubuntu 20.04 as development host and Raspberry Pi4 hardware.

API 变化列表

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