Qt 6.6 的新功能
Qt 6.6 中的新模块和恢复模块
Qt 6.6 添加了下列模块和工具:
技术预览中的新模块和恢复模块
注意:
不保证 API (应用程序接口) 和 ABI (应用程序二进制接口) 的稳定性。
Qt Graphs 模块
Qt Graphs
is meant to be the replacement module for Qt Data Visualization. It uses Qt Quick 3D as the rendering engine to provide support for native graphics backends, instead of relying on OpenGL 2.1, like Qt Data Visualization does.
The module will provide most, if not all of the functionality of Qt Data Visualization. Some advanced features may be incomplete in Technical Preview.
Qt 6.6 的新特征
Qt Core 模块
-
添加
Q_NODISCARD_CTOR
macro that should be applied to mark constructors nodiscard. The macro resolves to
[[nodiscard]]
on compilers that support it, and does nothing on other compilers.
-
添加
assign()
overloads to the following Qt containers:
QVarLengthArray
,
QList
,
QByteArray
and
QString
. These functions are a convenient way to assign new data while reusing the existing
capacity()
.
-
You can omit the
contents
of any file added to the resource file system by specifying the QT_DISCARD_FILE_CONTENTS source file property in CMakeLists.txt. The file
nodes
will be retained. When manually writing
.qrc
files you can achieve the same effect by setting the
empty
attribute of a
file
XML node to
true
.
-
QFileInfo
got a new
readSymLink
() member function that returns the raw path, and new overloads taking a
QTimeZone
for functions related to time stamps.
-
The
QProcess::UnixProcessParameters
struct and the
QProcess::UnixProcessFlag
enum can be used in the new
QProcess::setUnixProcessParameters
() member function to modify Unix-specific settings and parameters of a child process, such as closing extraneous file descriptors.
-
新的
QNativeIpcKey
class holds a native key used by
QSharedMemory
and
QSystemSemaphore
, providing better support for sandboxed applications on Apple platforms. See
本机 IPC (进程间通信) 键
了解更多信息。
-
Most Qt APIs working with time spans have been ported to relevant data types from
std::chrono
.
-
QXmlStreamReader::hasStandaloneDeclaration
() reports whether the document has an explicit standalone declaration.
Qt GRPC 模块
Qt GUI 模块
-
Added QFont::setFeatures() for direct access to OpenType features in the font.
-
QPalette
now has an
accent
() color entry that uses the systems' accent color by default.
-
The
QRhi
family of classes are now fully documented and offered as APIs with a limited compatibility promise. The Qt Rendering Hardware Interface is a 3D graphics API and shading language abstraction layer that is used by modules such as Qt Quick and Qt Quick 3D to implement cross-platform, portable rendering engines and material systems that can function on top of Direct 3D 11/12, Vulkan, Metal, OpenGL, and OpenGL ES. Applications that wish to perform their own low-level rendering without directly relying on potentially platform-specific 3D APIs and shading languages can now use
QRhi
and the related classes to augment a Qt Quick scene, render to a
QWindow
, perform offscreen rendering into a texture, or to dispatch GPU compute workloads. In previous Qt 6 releases the
QRhi
classes were fully private and the documentation was not provided as part of the standard Qt documentation set. Now they are treated similarly to the QPA (QPlatform*) classes, meaning they form a special set of classes that do not offer all the standard patterns and source/binary compatibility promises of public Qt APIs, but are nonetheless available for use by intermediate/advanced level application developers. The documentation for the
QRhi
APIs is now part of the standard Qt documentation. Also introduced the
rhiwindow example
.
-
Added a Direct 3D 12 backend for
QRhi
. This does not currently affect any applications because Qt Quick's and
QQuickWidget
's default backend choice continues to be Direct 3D 11 on Windows, and this is not expected to change in the foreseeable future either. The new D3D12 backend should be considered experimental for the time being, and is useful primarily for applications that have a need to get Qt to perform its rendering via Direct 3D 12 in order to simplify interoperating with the application's own or some external component's rendering or compute engine requiring D3D12.
-
Qt 6 applications can now support custom or platform specific clipboard formats, using the new
QUtiMimeConverter
(for macOS) and
QWindowsMimeConverter
for Windows) classes. Those classes are unified versions of the QMacPasteboardMime and QWindowsMime types from Qt 5. See the
porting guide
for help with adapting an existing implementation.
-
QTextListFormat::setStart
() allows for a text list to start with an index other than 1.
Qt Location 模块
-
Map items are now rendered more correctly, including those that wrap around the globe or contain holes.
-
Map items can now be rendered using different reference surfaces. The
QLocation::ReferenceSurface
enum provides options
Map
and
Globe
, which can be used with the
referenceSurface
properties in the item types to control whether an item is rendered on a flat map, or follows the globes curvature.
-
The mouse wheel can change the
bearing
when the Shift modifier is held, or change the
tilt
when the Control modifier is held.
-
The Qt Multimedia library no longer requests audio or video permissions, but only checks if they are provided or not. The client applications must request the permissions using the
C++
or
QML
permissions API.
-
新的
QWindowCapture
class adds support for capturing videos of individual desktop application windows within a
QMediaCaptureSession
. The recorded video can be directed to any type of video output, for example to the
QMediaRecorder
or to the
QVideoWidget
. Window capturing is only supported with the FFmpeg backend.
-
QMediaRecorder
has been extended with properties that gives better control of video quality, resolution, and bit rates.
Qt PDF 模块
Qt Positioning 模块
-
The Qt Positioning library no longer requests the location permissions, but only checks if they are provided or not. The client applications must request the permissions using the
C++
or
QML
permissions API.
Qt Protobuf 模块
-
Enabled using certain Qt Core and Qt GUI types as a part of *.proto schema.
-
Integrated QML-types support for auto-generated
QProtobufMessage
类。
-
Migrated to the implicitly shared data for auto-generated
QProtobufMessage
classes. This allows accessing the message types
by-value
from a QML context without making a lot of copies.
-
Added the Qt Protobuf Well-Known Types support for the
google.protobuf.Any
类型。
-
Integrated support for the
oneof
type, a union-like type in protobuf, that need not contain a value.
Qt Bluetooth 模块
-
The Qt Bluetooth library no longer requests the bluetooth permissions, buts only checks if they are provided or not. The client applications must request the permissions using the
C++
or
QML
permissions API.
-
Qt now provides a native 128-bit unsigned int type as quint128. On platforms that support it, the
QBluetoothUuid
(quint128) constructor and the
QBluetoothUuid::toUInt128
() method now use this type instead of a custom struct that earlier Qt versions used. As long as your code treats quint128 as an opaque type, the change is source- and binary-compatible, but consider using the new overloads taking
QUuid::Id128Bytes
if you encounter any issues. Platforms that do not support the 128-bit int types (such as MSVC) still use the custom struct from Qt Bluetooth.
Qt QML 模块
-
Added support for managing application permissions via QML. The
Qt QML Core
module exposes the Qt C++
应用程序权限
functionality to QML via a set of permission types that can be used to check or request permission in a cross platform manner. See
QML Application Permissions
了解更多信息。
-
The
XMLHttpRequest
object has now been updated with two more features, in order to bring it closer to modern browsers. The
responseURL
property has been added, which can be used to confirm whether any redirects has occurred. Similarly, the
overrideMimeType
method has been added, which can be used to make the
XMLHttpRequest
object parse the response based on a specific mime type, rather than what's in the Content-Type header of the response.
-
The QML language server has gotten initial support for go-to definition and find usages. It also supports full document formatting.
-
It is now possible to extend qmllint with plugins. The plugin API is currently in tech preview.
Qt Quick 模块
-
添加
font.features
property for direct access to OpenType features in the font.
-
TableView
拥有
selectionMode
property to control whether single or multiple cells can be selected.
-
TreeView
拥有
rootIndex
property to show only a subtree from the model.
-
AnimatedImage
now supports the
sourceSize
特性。
-
环境变量
QT_QUICK_FLICKABLE_WHEEL_DECELERATION
lets you customize the deceleration after scrolling with a "clicky" wheel mouse. By default, acceleration is now turned off so that scrolling distance is proportional to the number of "clicks" (unless the platform provides its own acceleration); but you can set a value less than 15000 to restore old behavior. The
flickDeceleration
property now applies only to touch flicks.
-
Most properties are now
FINAL
, meaning that they can no longer be shadowed by declaring new properties with the same names. A warning will be emitted if a
FINAL
property is shadowed. We recommend that users rename such properties to avoid unexpected behavior changes.
-
Added and exposed a number of
QRhi
-related functions in
QQuickWindow
,
QQuickRenderControl
,和
QSGTexture
. Querying the
QRhi
,
QRhiSwapChain
,或
QRhiCommandBuffer
used by the onscreen or offscreen Qt Quick rendering is now simplified. Some functions previously hidden from the documentation due to relying on
QRhi
* classes are made visible. Added
createTextureFromRhiTexture
() 到
QQuickWindow
serving as the counterpart of createTextureFromImage().
-
Updated the scenegraph examples: added
rhiunderqml
, replaced the legacy, OpenGL-only fboitem example with a new, portable
rhitextureitem example
, and updated the
customrendernode example
. These together demonstrate the three ways to extend a Qt Quick scene with custom low-level 2D/3D rendering (the three approaches being: underlay/overlay, custom item backed by rendering to a texture, custom item with
QSGRenderNode
).
-
Added Path::simplified property for automatic simplification of paths before rendering them. This mirrors the
QPainterPath::simplified
() 函数。
-
Added support for collecting GPU timestamps for the
QQuickWindow
's rendering. When enabled by
QQuickGraphicsConfiguration
's
setTimestamps
() or the corresponding environment variable, GPU-side timings will appear in the debug output printed when enabling logging categories such as
qt.scenegraph.time.renderloop
, and in Qt Quick 3D's
DebugView
item, complementing the CPU-side timings. This is currently supported on Direct 3D 11, Metal, and Vulkan (assuming the underlying Vulkan implementation supported timestamp queries). Support for the rest of the 3D APIs is going to be introduced in future releases.
Qt Quick Controls 模块
-
添加
live
特性到
SpinBox
. This controls whether the
value
is updated when the user edits the
displayText
.
-
添加
wrapped
signal to Dial. This is emitted when the dial wraps around, i.e. goes beyond its maximum value to its minimum value, or vice versa.
-
添加
startAngle
and
endAngle
properties to Dial. These properties control the start and end angle of the dial in degrees.
Qt Quick Layouts 模块
Qt Quick Shapes 模块
-
Added experimental curve rendering backend, which will render curves with higher quality than the default geometry renderer and apply anti-aliasing without the use of MSAA. It can be selected using the
Shape::preferredRendererType
特性。
Qt Quick 3D 模块
-
Added a QML API for creating
TextureData
procedurally called
ProceduralTextureData
. Previously this was only possible via C++ by subclassing
QQuick3DTextureData
.
-
Added a QML API for creating mesh geometry procedurally called
ProceduralMesh
. Previously this was only possible via C++ by subclassing
QQuick3DGeometry
.
-
It is now possible to import PLY files.
-
Added support for creating 3D textures with
QQuick3DTextureData
.
-
Added initial Renderer Extensions support. This is the first steps to allowing adding additional passes and enabling the customization of the built in render passes.
View3D
has a new property called extensions which takes an array of
QQuick3DRenderExtension
sub-classes. This is further supported using the helper functions in
QQuick3DExtensionHelpers
.
Qt Sql 模块
-
A plugin for
Mimer SQL
was added
-
MySQL/MariaDB gained the new connect options MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_TLS_VERSION, MYSQL_OPT_SSL_MODE
-
The ODBC plugin now returns all native error codes in
QSqlError
-
QSqlQuery
got two new functions boundValueName()/boundValueNames()
Qt TextToSpeech 模块
The
QTextToSpeech
class learned a few more tricks that are available with all engines:
-
Applications can add multiple chunks of text to a synthesizing engine via
enqueue
.
-
新的
aboutToSynthesize
signal gets emitted just before a chunk of text gets synthesized.
-
Selecting one of the voices provided by the engine using a set of criteria is now easy with the
findVoices
member function. QML code can in addition use the
VoiceSelector
type as an attached property.
Not all new features are available with every engine. Applications can use the new
Capabilities
flag and
engineCapabilities
property to check which of the following new features the currently used engine supports:
Qt WebEngine 模块
-
QWidget
got a new setTabOrder() overload that takes an initializer list, allowing the entire chain to be set with a single call.
-
QMessageBox::Option
provides the means to control for each message box whether a native message box should be used.
macOS
-
Building user projects or Qt for macOS itself now requires at least CMake version 3.21.1.
-
QMessageBox::setCheckBox
() is now respected when using native message boxes.
-
QFileDialog
no longer triggers permission dialogs needlessly.
Android
-
Added FileProvider support when using
QDesktopServices::openUrl
().
-
Added AndroidX by default (a dependency for FileProvider).
-
引入
QTP0002
CMake policy for android-specific target properties.
-
Updates for the list of examples that are supported on Android.
-
Android 13 as the maximum supported version
-
Updated Gradle to version 8.3.0.
-
QFileDialog
takes all provided name filters into effect and not only the selected one.
-
Updated Android target SDK level to 33 to match Play Store requirement for 2023.
iOS
-
添加支持
QWindow::setMask
() for masking rendering and input.
-
Added support for foreign windows, for embedding UIViews into QWindows.
Boot to Qt
-
Support was added for Yocto 4.2 (mickledore).
-
The
目标硬件的支持级别
were updated with new supported boards:
-
Tier 1 support for the NXP i.MX 93 board added.
-
Tier 1 support for the Jetson AGX Xavier board added.
-
Tier 3 support for the NXP i.MX 8QuadXPlus board added.
-
Tier 3 support for the Toradex Apalis iMX8 board added.
-
Toradex and ST targets are now using latest Yocto LTS version (kirkstone).