Qt 6.7 的新功能

Qt 6.7 的新特征

Qt Core 模块

  • 添加 QSpan ,C++20 std::span 的 Qt 重实现。
  • 添加 Qt::strong_ordering , Qt::weak_ordering ,和 Qt::partial_ordering classes that are a C++17-compatible implementation of std::*_ordering 类。
  • Added helper macros to conveniently implement relational operators in Qt classes. These macros provide operator<=>() in C++20 builds, and fall back to all six relational operators in C++17 builds.
  • 将这些帮手宏应用到 QDate , QTime , QDateTime , QTimeZone ,和 qfloat16 类。
  • 添加新类 QAtomicScopedValueRollback .
  • 添加 Qt::Key_micro to eventually replace the misnamed Key_mu: it is the micro sign U+00B5, not the Greek letter mu, U+03BC or U+039C.
  • QLocale 's name(), bcp47Name() and uiLanguages() now let callers specify the separator to use between tags in names.
  • QLocale now localizes (in so far as it can) the time zone parts of formatted datetimes.
  • Date (and datetime) parsing of two-digit years now allows the caller to control the century within which those years are selected.
  • QCalendar now has a matchCenturyToWeekday(), to support the parsing of two-digit years.
  • QDateTime now accepts TransitionResolution parameters, allowing callers control over how time-zone transitions are resolved. The default resolution of a datetime in a gap is now valid but its time() and possibly date() now match what toMSecsSinceEpoch() reports, rather than what was asked for.

Qt Graphs 模块

  • Data API for 3D graphs does not require creating every data item into heap memory.
  • Render to image functionality added for Bars3D , Scatter3D ,和 Surface3D 图形。
  • Some redundant classes were removed and the necessary functionality moved elsewhere.
  • Enums were made scoped.
  • A number of other architectural and functional changes.
  • Performance and visual quality improvements.
  • Technology Preview added for 2D graphs, which contains initial support for bar, line and scatter graphs.

Qt GRPC 模块

注意: Qt GRPC 模块在技术预览。

Qt GUI 模块

Qt Multimedia 模块

  • 在 Windows,FFmpeg 多媒体后端现在与 FFmpeg 动态链接。FFmpeg 预构建二进制的提供,是透过在线安装程序。使用 FFmpeg 后端的 Windows 应用程序,现在必须使用 windeployqt 将 FFmpeg 二进制捆绑作为其安装程序的一部分。
  • 新的 MediaPlayer::autoPlay and Video::autoPlay 特性可以用于自动开始回放,当有设置媒体源时。
  • The QCameraDevice 拥有新的 correctionAngle 特性。此特性表示所需的旋转角度,以补偿相机比较物理相机其本机取向的旋转。

Qt Network 模块

Qt OPC UA 模块

Qt Protobuf 模块

  • Added the new serializer that implements JSON serialization and deserialization functionality for QProtobufMessage -based classes.
  • Added support of 'optional' fields in the Qt Protobuf generator. If the message field is marked as 'optional', it gets clear<fieldName> and has<fieldName> methods in addition to the regular field one.
  • Enum fields generated by the Qt Protobuf generator now preserve the case of first letter. Previosly generator capitalized the generated enum field names.

注意: The Qt Protobuf Module is under Technology Preview.

Qt QML 模块

  • Added new features to QML Language Server: formatting, semantic and code snippet completions, renaming usages, and setting file generation in CMake via QT_QML_GENERATE_QMLLS_INI.
  • The translation context of a QML file can be set via pragma Translator
  • 现在可以声明 QML_CONSTRUCTIBLE_VALUE and QML_STRUCTURED_VALUE on value types and construct objects of such types from QML. In fact you could already since Qt 6.5, but now it's officially supported.

Qt Quick 编译器

  • Bindings and functions that write properties of value types can now be compiled to C++
  • Optional chaining can now be compiled to C++
  • for..in iteration can now be compiled to C++

Qt Quick 模块

Qt Quick Controls 模块

Qt Quick Shapes 模块

  • The Curve Renderer and the associated property preferredRendererType are now officially supported and are no longer considered experimental.
  • 添加 pathHints property for characterizing shapes. This may be used by the renderer to optimize processing and rendering the paths.
  • Shapes now have an implicit size based on the bounding rect of the shape, and will be appropriately positioned in layouts. The properties fillMode , horizontalAlignment and verticalAlignment were added to modify how the shape behaves when the item is given an explicit size which differs from the implicit size.
  • 工具 svgtoqml was added as a technology preview. This is a tool which can be used to convert an SVG file into QML code. It is currently considered experimental and has support for a subset of what Qt SVG supports.

Qt Quick Timeline 模块

  • The QtQuick .Timeline.BlendTrees sub-module adds new APIs to enable blending multiple timeline animations.

Qt Quick 3D 模块

Qt Quick 3D Physics 模块

Qt Serial Bus 模块

  • 添加方法到 QCanDbcFileParser , which enables DBC file parsing with an encoding other than UTF-8.

Qt Sql 模块

  • The deprecated <qsql.h> header got removed. Use <qtsqlglobal.h> instead.

Qt WebEngine 模块

Qt Widgets 模块

  • 添加 QRhiWidget class (under technology preview) for rendering 3D graphics via any hardware accelerated graphics API supported by Qt's rendering hardware interface, i.e. OpenGL, Vulkan, Direct3D, or Metal.
  • QCheckBox got a new signal checkStateChanged that emits the new check state as a type safe Qt::CheckState 枚举值。
  • QDateTimeEdit got a new timeZone property
  • On Systems running Windows 11 and above the new Windows 11 widget style is used by default. This style supports Windows dark mode.

Qt SVG 模块

  • Added support for some elements from SVG 1.1 standard. The elements are Mask, Symbol, Marker, Pattern, Filter, and Filter Primitives (feMerge, feColorMatrix, feGaussianBlur, feOffset, feComposite, feFlood)
  • 添加 QtSvg::Options flag to enable or disable rendering of the new elements.
  • Added setters and getters for the QtSvg::Options for QSvgRenderer and QSvgWidget . The new features are enabled by default.

工具

Qt Designer

  • Qt Designer now writes fully qualified enumeration values to the .ui files in order to support scoped enumerations and Qt for Python. Support for reading these values has been back-ported to 6.6.1 and 6.5.4.

平台的变化

桌面平台

Windows

macOS

  • macOS 14 is now a supported build and target platform.

Linux 中的 Wayland 客户端

WebAssembly

  • Added drop support (drag-and-drop). Qt will now send drop events when the user drops content on application windows.
  • OpenGL ES 3 / WebGL2 is now default, with fallback to OpenGL ES2 / WebGL 1.
  • Emscripten version updated to 3.1.50

移动平台

Android

  • Re-factored the Android plugin Java code which, consists of:
    • Simplifying the architecture and the relation between the various classes (for example, between QtActivity, QtActivityLoader, and QtActivityDelegate).
    • Moving the QtLoader classes away from the public bindings package.
    • Removed usage of reflection.
  • Added preliminary support for child windows for Android to be consistent with Qt and its other QPAs. As a result of that, QScreen::grabWindow () is temporarily unsupported for now.
  • Set Android 14 as the maximum supported platform version, and the default platform SDK and target levels to API 34.
  • Set the supported Android NDK version to r26b (26.1.10909125) and JDK to 17.
  • Aligned the Mobile category examples with iOS.
  • 添加 QNativeInterface::QAndroidScreen that provides access to the Android Display id of a QScreen .
  • Added support for using ndk-stack with androidtestrunner to pretty print test crash reports.
  • Added CMake variable QT_ANDROID_DEPLOYMENT_TYPE to explicitly set the deployment type for the Android package.
  • Overall re-write and update for Qt Android platform documentation.
  • Introduced features to use the powers of Qt in Android projects:

iOS

  • iOS 17 is now a supported target platform.

嵌入式平台

Boot to Qt

  • Support was added for Yocto 4.3 (Nanbield).
  • Support added for ARM Linux development hosts.
  • Squish support included in the target images.
  • The 目标硬件的支持级别 was updated with new supported boards for Tier 3:
    • Amazon AWS EC2 ARM64
    • NVIDIA Jetson AGX Orin Developer Kit
    • NXP i.MX8M Nano LPDDR4 EVK (replaces DDR4 EVK variant)
    • Qualcomm Robotics RB5 Development Kit
    • TI SK-AM69

VxWorks

  • Added VxWorks 23.09 support as Technology Preview.

构建系统变化

  • Qt C++ headers now feature metadata for the IWYU 工具。
  • CMake: You can now tweak the arguments for *deployqt tools in qt_generate_deploy_app_script(), qt_deploy_runtime_dependencies() by setting the DEPLOY_TOOL_OPTIONS.
  • CMake: qt_add_library() now considers the value of the BUILD_SHARED_LIBS variable. If the variable is defined, it has higher priority than the library type detecting logic in qt_add_library() when adding the library targets.
  • CMake: qt_standard_project_setup() allows you now to set the native UI language of your application, as well as the languages the UI is translated to. This is then picked up by qt_add_translations() calls to generate .ts and .qm files that match the given languages, generating a 'plural-only' .ts file for the native language.
  • CMake: You can now pass multiple targets to qt_add_translations() to extract translations from. Alternatively, you can let qt_add_translations() collect all targets of a project (done via the new qt_collect_translation_source_targets() function), with the option to opt out of undesired targets on directory or target level.
  • CMake: qt_add_translations() has been moved out of technical preview.

WebOS

  • Qt 6.7 has been verified to work with LG webOS OSE 2.25.0 ( Qt for webOS ).

API 变化列表

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