Qt 6.4 的新功能
New and Restored Modules in Qt 6.4
Qt 6.4 adds the following modules:
-
Qt HTTP Server
- A module for embedding an HTTP server into Qt applications. This module is in technical preview, API and ABI stability is not guaranteed.
-
Qt Quick 3D Physics
- A high-level QML module adding physical simulation capabilities to Qt Quick 3D.
Qt 6.4 reintroduces the
Qt TextToSpeech
module from Qt 5. This module wasn't present in Qt 6.3. It now uses the CMake build system and works with Qt 6.
You'll find more details about changes to each module in
Qt 6 中的 Qt 模块变化
.
New Features in Qt 6.4
Qt Core 模块
-
添加
QLatin1StringView
as an alias for
QLatin1String
. This is now the recommended name for referring to a Latin-1 string view.
-
The
QLatin1StringView(const char *, qsizetype)
and
QLatin1StringView(const char *, const char *)
constructors are made non-explicit.
-
Added literal operator
_L1
for creating Latin-1 string and char literals in the
Qt::Literals::StringLiterals
名称空间。
-
Added literal operators
_s
and
_ba
for creating
QString
and
QByteArray
literals respectively, in the
Qt::Literals::StringLiterals
namespace. Deprecated
_qs
and
_qba
in favor of
_s
and
_ba
.
-
Deprecated QString::count() and QByteArray::count() that take no parameters, to avoid confusion with the algorithm overloads of the same name. They can be replaced by
size()
or
length()
方法。
-
QStringEncoder
and
QStringDecoder
support now all codecs supported by ICU when Qt is built with ICU support enabled.
-
In the classes for Android and JNI development,
QJniObject
and
QJniEnvironment
, overloads have been added for
callMethod
,
findMethod
and similar methods. It is now possible to call Java functions and register native methods without specifying a signature string.
-
The new template function
QJniObject::construct
() allows instantiating of a Java class from C++ without specifying a type or signature string.
-
QByteArray
now has a percentDecoded() instance method as an alternative to calling the fromPercentEncoding() static method on the instance.
-
QTextStream
now supports input and output of char16_t.
-
QStringView
now has a localeAwareCompare() method and can count() how many times a given sub-string appears.
-
QDate
can now be constructed from various std::chrono year-month-day structure types, when available, and it has an addDuration() taking a std::chrono::days, when available.
-
QDateTime
likewise gains an addDuration(std::chrono::milliseconds), along with arithmetic to add or subtract the same type, a difference of
QDateTime
values returning it, and a few static pseudo-constructors taking various std::chrono types describing a moment in time.
-
添加
QTimeZone::fromStdTimeZonePtr
(const std::chrono::time_zone *).
-
QCalendar
's construction by name now accepts
QAnyStringView
.
Qt GUI 模块
Qt Quick 模块
-
Several new properties and functions has been added to
TableView
that improves support for keyboard navigation and selection, row- and column selections, animations, sub-cell positioning, and more.
-
TreeView
now support selections, and has gained a broader API for expanding and collapsing nodes in the tree recursively.
-
QQuickWidget
is now functional with all supported 3D graphics APIs (Vulkan, Metal, Direct3D 11) in addition to OpenGL. Applications no longer have to enforce rendering with OpenGL when using
QQuickWidget
.
-
Added support for arrays of combined image samplers in shaders used with custom materials. This is supported by the new function
QSGMaterialShader::combinedImageSamplerCount
() and the enhanced semantics of the existing
texture
argument of
QSGMaterialShader::updateSampledImage
().
-
Added support changing the polygon rasterization mode from
solid
to
line
in
QSGMaterialShader::GraphicsPipelineState
. (available only when the 3D API in use supports this)
-
ShaderEffectSource.format
and
layer.format
were not useful in previous Qt 6 releases, with the legacy values ignored in practice. This is now documented and new, actually useful values are introduced, in particular to enable requesting floating point (FP16 or FP32) textures instead of RGBA8, if desired.
-
添加
QQuickRenderTarget::fromPaintDevice
(), enabling redirecting the output from a
QQuickWindow
使用
software
backend as well.
-
Added overloads in
QQuickRenderTarget
that enable specifying the native format of the texture or image object. This is relevant in some advanced use cases when one has to work with native textures that are not RGBA8. Note that only native formats that are supported by Qt's rendering infrastructure are accepted.
-
添加
setMirrorVertically
() 到
QQuickRenderTarget
, which allows requesting the Qt Quick renderer to alter its matrices to get vertically flipped results when redirecting the 3D API-based rendering into a texture.
-
Qt Quick windows will now attempt to use the software rasterization platform of Direct 3D (WARP) in case the primary graphics device is not compatible with Qt, without having to resort to manually setting environment variables.
-
Added simple heuristics to the
threaded
render loop of the Qt Quick scenegraph for recognizing broken vsync-based throttling. When frames are rendered/presented too fast, without blocking the render thread, it now switches automatically to the regular timer-based approach of running animations, thus preventing QML animations running too fast.
-
添加
FrameAnimation
for custom animations. Allows running custom scripts in synchronization with the animation frames.
Qt Quick Controls 模块
-
Added a new native-looking style for iOS,
iOS Style
, as Tech Preview.
-
TreeViewDelegate
has three new properties that describes if it's current, selected, or highlighted in the
TreeView
.
Qt Quick Dialogs 模块
-
添加
ColorDialog
. This is a native dialog on platforms that support it, and a non-native Qt Quick dialog on other platforms.
The non-native dialog supports all of the non-native styles: Basic, Fusion, Imagine, Material and Universal.
-
QFormLayout
has new
isRowVisible
() 和
setRowVisible
() member functions, with overloads that allow hiding and showing rows by index, input widget, or row layout.
-
QKeySequenceEdit
拥有新的
clearButtonEnabled
property. Use it to control whether the widget shows a clear button that allows the user to clear the edit.
-
QWizard
has a new slot,
setCurrentId
, that allows applications to move to a page without visiting the pages between the current page and the target.
Qt Network 模块
-
添加
QSslServer
. This simplifies creation of a server which solely communicates over TLS.
-
QNetworkInformation
now has loadBackendByFeatures(Features) and loadBackendByName(
QStringView
), meant to eventually replace the corresponding overloaded load(Features/
QStringView
) functions which are now marked as deprecated.
Qt Test 模块
-
QTestEventLoop::enterLoopMSecs() now uses a PreciseTimer if the timeout is less than a second.
-
Custom QTest::compare() implementations should now revise any calls to QTest::compare_helper() to use one of the two new overloads instead of the old one, which is now deprecated (so as to only generate the strings to represent values in a failure report if the check actually does fail).
-
添加
QAbstractItemModelTester::setUseFetchMore
().
-
New macros QCOMPARE_{EQ,NE,GT,GE,LT,LE}() support comparisons with reporting similar to that of
QCOMPARE
(). The EQ one does exact comparisons, without
QCOMPARE
()'s customizations. These also come with the usual QTRY_COMPARE_*() and QTRY_COMPARE_*_WITH_TIMEOUT() variants.
Qt QML 模块
-
QML Language
-
You can register custom value types with names now. That is, the argument to
QML_VALUE_TYPE
is no longer ignored. It must be lower case. Once registered, you can declare properties of your own value types in QML.
-
You can store any named value type in a list in QML now. For example list<rect> in QML is like a
QList
<
QRectF
> in C++. This removes the need to use var for such properties or wrap their elements into objects.
-
The new pragma ComponentBehavior lets you specify whether components defined in a QML file can be used outside of their creation context. If not (pragma ComponentBehavior: Bound), then Qt Quick Compiler can optimize your code better.
-
QML Type Compiler (qmltc)
-
Expanded QML language coverage
-
QML Script Compiler (qmlsc, qmlcachegen)
-
Various operations on lists of value types are now compiled to C++.
-
Dead code and dead stores are optimized out more aggressively now.
-
Type conversions now happen at the place where a value is written, not at the place where it's read. If the value is read multiple times, this is faster.
-
QML Linter (qmllint)
-
Added new warnings regarding proper use of
QtQuick
and
QtQuick
.Controls
-
QML Language Server (qmlls)
-
Added completions support
-
Added code action fixing for some linter warnings/hints
-
Moved executable to libexec
-
Cleaned up CMake API:
Qt Quick 3D 模块
-
Added a preview of lightmap baking support. This provides a static global illumination solution with lightmaps pre-generated using raytracing. See
Lightmaps and Global Illumination
了解细节。
-
添加
SpecularGlossyMaterial
to enable using the specular/glossiness workflow instead of metalness/roughness.
-
添加
LineParticle3D
type that allows creating line shaped sprite particles.
-
添加
Model.castsReflection
property to control if a model is rendered by reflection probes and if it can be seen in reflections. The same property is also introduced for
sprite particles
.
-
添加
ReflectionProbe.boxOffset
property to move the box relative to the position of the probe without affecting the position of the capture point.
-
添加
ReflectionProbe.debugView
property to display a cube visualizing the probe box.
-
添加
HeightFieldGeometry
to enable creating a height-field geometry from an image file.
-
添加
CubeMapTexture
to enable custom materials and post-processing effects to work with cube map textures in the shaders. The input is either a
.ktx
container with image data for all 6 faces, or 6 individual image files.
-
Added support for rendering a skybox from a cubemap instead of the light probe. This can be requested by setting the background mode
SceneEnvironment.SkyBoxCubeMap
.
-
添加
ProceduralSkyTextureData
to procedurally generate a HDR light probe or sky box texture.
-
Improved shadow rendering for point and spot lights.
-
添加
renderFormat
特性到
View3D
to allow specifying the backing texture format when the
View3D
is using its (default) Offscreen render mode. The available values are the same as with
ShaderEffectSource.format
(which itself is also revised in 6.4). This enables using floating point textures instead of the default RGBA8.
-
Support for importing UIP files was removed. The mapping from old Qt 3D Studio features to Qt Quick 3D was problematic in previous releases already. Therefore, Qt 6.4 removes support for
.uip
files from the
balsam
工具。
Qt Connectivity 模块
Qt WebEngine 模块
WebAssembly
Qt is now fully supported on the WebAssembly platform. See the platform documentation at
Qt for WebAssembly
了解细节。
Android
-
Updated Gradle to 7.4.2 and Android Gradle Plugin to 7.2.1.
-
Updated NDK to r23b (23.1.7779620).
-
Added CMake variables
QT_ANDROID_SIGN_APK
and
QT_ANDROID_SIGN_AAB
to build signed packages directly from CMake.
-
Android Accessibility is now aware of scroll events.
-
Improved assets loading speed for Android apps.
Boot to Qt
-
Boot to Qt stack was updated to use Yocto 4.0.3 (kirkstone).
-
NXP i.MX8M Plus LPDDR4 EVK added as a new reference device.
QNX
WebOS
-
Qt 6.4 has been verified to work with LG webOS OSE 2.18.0 (
Qt for webOS
).
API 变化列表
These pages contain an overview of API changes in Qt 6.4: