October 10, 2023 by Volker Hilsheimer | Comments
2023年10月10日作者:Volker Hilsheimer |评论
Today marks the 6th time we are releasing new functionality in the Qt 6 series, with small and large additions that make both UI and backend development more productive and fun. Several of the new features come as technology previews, and we are looking forward to your feedback so that we can get everything in tip-top shape for the next LTS release!
今天是我们第六次在Qt6系列中发布新功能,大大小小的添加使UI和后端开发更加高效和有趣。一些新功能是技术预览版,我们期待您的反馈,以便我们能够在下一个LTS版本中获得最佳状态!
Let's start with some highlights for user interface developers.
让我们从用户界面开发人员的一些亮点开始。
User Interfaces written with Qt have always benefitted from the layout system taking care of positioning and sizing the various elements. This results in resizable UIs that look good in all environments. However, until now it took a bit of manual effort to make user interfaces that adapt the layout itself dynamically, e.g. based on to the available screen space or orientation. This might involve hiding some elements and showing others, replacing parts of the layouts, or even completely re-building the layout structure.
使用Qt编写的用户界面一直受益于布局系统,该系统负责定位和调整各种元素的大小。这将导致可调整大小的UI在所有环境中都很好看。然而,到目前为止,制作动态调整布局本身的用户界面需要一些手动操作,例如基于可用的屏幕空间或方向。这可能涉及隐藏一些元素并显示其他元素,替换布局的一部分,甚至完全重新构建布局结构。
With Qt 6.6, we are introducing a new layout element to Qt Quick, the LayoutItemProxy. With this proxy, user interface designers can create and switch between different layouts, typically by binding to geometry properties of the window, and the proxy takes care of automatically placing the user interface elements in the currently active layout structure. Read more about our solution, how it compares to other UI technologies, and how we designed our system, in the blog post about responsive layouts. To give more control over how layouts distribute their content, Qt Quick Layouts learned about uniform cell sizes for row, column, and grid layouts.
使用Qt 6.6,我们将在Qt Quick中引入一个新的布局元素LayoutItemProxy。有了这个代理,用户界面设计者可以创建不同的布局并在不同的布局之间切换,通常是通过绑定到窗口的几何属性,代理负责自动将用户界面元素放置在当前活动的布局结构中。在关于响应式布局的博客文章中,阅读更多关于我们的解决方案,它与其他UI技术的比较,以及我们如何设计系统。为了更好地控制布局如何分发内容,Qt Quick layouts学习了行、列和网格布局的统一单元格大小。
Additional new features in the Qt Quick module include support for selection modes in TableView, changing the rootIndex in a TreeView, more control over scroll-deceleration in a flickable, and automatic path simplification.
Qt Quick模块中的其他新功能包括支持TableView中的选择模式、更改TreeView中的rootIndex、在轻弹中对滚动减速的更多控制以及自动路径简化。
The Qt Graphs module will combine the functionality of the old OpenGL-based Qt DataVisualization and Qt Charts modules into a single, modern Qt 6 framework. With this first technology preview release of Qt Graphs we are taking the initial step into that direction, focusing on the functionality currently provided by Qt DataVisualization. With Qt Graphs, applications can visualize large quantities of rapidly changing data, using a variety of visualization techniques such as bar, scatter, and surface graphs. The implementation uses Qt 6's rendering hardware interface, and sits on top of Qt Quick 3D. This way, all rendering is hardware accelerated using the native graphics system, and the 3D visualization integrates seamlessly into the scene management and interaction functionality provided by Qt Quick 3D.
Qt Graphs模块将把旧的基于OpenGL的Qt数据可视化和Qt图表模块的功能结合到一个单一的现代Qt 6框架中。随着Qt Graphs的首次技术预览发布,我们正朝着这个方向迈出第一步,重点关注Qt DataVisualization目前提供的功能。使用Qt Graphs,应用程序可以使用各种可视化技术(如条形图、散点图和曲面图)可视化大量快速变化的数据。该实现使用Qt6的渲染硬件接口,并位于QtQuick 3D之上。通过这种方式,所有渲染都使用本地图形系统进行硬件加速,3D可视化无缝集成到Qt Quick 3D提供的场景管理和交互功能中。
The module is under active development, with research focusing on an architecture for effective and consistent data management across all use cases, and a high-performant rendering architecture for charts. Have a look at this prototype from earlier this year to get an idea about what we would like to enable with Qt Graphs:
该模块正在积极开发中,研究重点是在所有用例中实现有效和一致的数据管理的架构,以及图表的高性能渲染架构。看看今年早些时候的这个原型,了解我们希望使用Qt Graphs实现的功能:
https://youtu.be/h0jizx5IAaw
With Qt 6.5, we introduced support for screen capturing in Qt Multimedia. With Qt 6.6 we are expanding this feature to allow applications to capture individual windows. The QWindowCapture API and it's QML counterpart provides access to the list of capturable window, so applications that want to implement screen or window sharing can easily provide end-users with a choice of windows. Window capturing support is available with the FFmpeg backend on all desktop platforms, except Wayland-based systems.
在Qt 6.5中,我们引入了对Qt Multimedia中屏幕捕获的支持。使用Qt 6.6,我们正在扩展此功能,以允许应用程序捕获单个窗口。QWindowCaptureneneneba API及其对应的QML提供了对可捕获窗口列表的访问,因此想要实现屏幕或窗口共享的应用程序可以轻松地为最终用户提供窗口选择。除基于Wayland的系统外,所有桌面平台上的FFmpeg后端都支持窗口捕获。
QMediaRecorder has in addition been extended with new properties for control over video quality, resolution, and bit rates.
QMediaRecorder还扩展了新的属性,用于控制视频质量、分辨率和比特率。
Following the introduction of Qt GRPC and Qt Protobuf in Qt 6.5 as technology previews, Qt 6.6 brings significant enhancements to QtGRPC
and QtProtobuf
. New options like QGrpcChannelOptions and QGrpcCallOptions make channel and call configuration much easier. These options now support a deadline mechanism, limiting the maximum execution time of the call or stream. The new QGrpcMetadata allows users to set client metadata and read metadata returned from the server. In the new release, QtGRPC has integrated QML-type support for the auto-generated QtGRPC client classes.
在Qt 6.5中引入Qt GRPC和Qt Protobuf作为技术预览之后,Qt 6.6为Qt GRP和Qt Procobuf带来了显著的增强。QGrpcChannelOptions和QGrpcCallOptions等新选项使通道和调用配置更加容易。这些选项现在支持截止日期机制,限制调用或流的最长执行时间。新的QGrpcMetadata允许用户设置客户端元数据并读取从服务器返回的元数据。在新版本中,QtGRPC集成了QML类型的支持,支持自动生成的QtGRPPC客户端类。
In QtProtobuf
, certain Qt Core and Qt GUI types can now be part of the *.proto schema. Implicitly shared data for QProtobufMessage
classes allows efficient access in QML contexts. Support for google.protobuf.Any
type has been added. Additionally, the oneof
type, similar to a union in protobuf
, enhances data modelling flexibility.
在QtProtobuf中,某些QtCore和QtGUI类型现在可以成为*.proto模式的一部分。QProtobufMessage类的隐含共享数据允许在QML上下文中进行高效访问。已支持添加google.protobuf.Any
类型。此外,oneof类型类似于protobuf中的并集,增强了数据建模的灵活性。
Applications that use Qt WebEngine to render web content can now use APIs to access the privacy and security settings. This gives more control about how the Chromium runtime behaves, and allows disabling unwanted capabilities. For example, the QWebEngineUrlScheme::FetchApiAllowed flag can be used to disable or enable the HTML5 Fetch API for custom URL schemes, and the QWebEngineSettings::DisableReadingFromCanvas attribute allows an application to disable reading from the canvas as a protection against finger-printing.
使用Qt WebEngine渲染web内容的应用程序现在可以使用API访问隐私和安全设置。这样可以更好地控制Chromium运行时的行为,并允许禁用不需要的功能。例如,QWebEngineUrlScheme::FetchApiAllowed标志可用于禁用或启用自定义URL方案的HTML5 Fetch API,而QWebEngineSettings::DisableReadingFromCanvas属性允许应用程序禁用从画布读取,以防指纹。
Another useful feature added to Qt WebEngine is support for a new chrome://qt
URL, which shows a page with information about the Chromium version used.
添加到QtWebEngine的另一个有用功能是支持chrome://qtURL,它显示了一个包含所使用Chromium版本信息的页面。
A new API in the Font type of Qt Quick allows UI builders to configure specific OpenType font shaping features, and the Qt Quick Shapes module can now use an experimental curve renderer that produces higher quality anti-aliased rendering of curves using a specialized fragment shader.
Qt Quick字体类型中的新API允许UI构建器配置特定的OpenType字体整形功能,Qt Quick Shapes模块现在可以使用实验曲线渲染器,该渲染器使用专用片段着色器生成更高质量的抗锯齿曲线渲染。
Curve renderer, scaled
曲线渲染器,缩放
Geometry renderer, scaled
几何体渲染器,缩放
Geometry renderer with multi-sampling, scaled
具有多重采样、缩放的几何体渲染器
The Ghostscript tiger's tooth rendered at approximately 20x scale. Left to right: curve renderer, geometry renderer and geometry renderer with multi-sampling.
Ghostscript老虎的牙齿以大约20倍的比例渲染。从上到下:曲线渲染器、几何体渲染器和具有多重采样的几何体渲染机。
Qt's Rendering Hardware Interface abstraction provides a common, low-level API for developing code against the platform-native rendering sub-systems, such as OpenGL, Vulkan, Metal, and Direct3D, which now can also use D3D12. For Qt 6.6 we have started to open up and document the RHI APIs, with the same level of compatibility commitment as we have for our QPA APIs: source and binary incompatible changes might happen between minor releases of Qt, but not within a patch release cycle. This makes it possible for application developers to write low-level, cross-platform code that works on all relevant graphics stacks.
Qt的渲染硬件接口抽象提供了一个通用的、低级的API,用于开发针对平台渲染子系统的代码,如OpenGL、Vulkan、Metal和Direct3D,这些子系统现在也可以使用D3D12。对于Qt 6.6,我们已经开始开放并记录RHI API,与QPA API具有相同的兼容性承诺:源代码和二进制不兼容的更改可能发生在Qt的小版本之间,但不在补丁发布周期内。这使得应用程序开发人员可以编写在所有相关图形堆栈上工作的低级别跨平台代码。
Similar work is currently in progress for Qt Quick 3D, where future Qt releases will give application developers fine-grained control over the render pipeline. In Qt 6.6, Qt Quick 3D already learned how to create texture data and mesh geometries procedurally from QML.
Qt Quick 3D目前也在进行类似的工作,未来的Qt版本将为应用程序开发人员提供对渲染管道的细粒度控制。在Qt 6.6中,Qt Quick 3D已经学习了如何从QML按程序创建纹理数据和网格几何图形。
Following the initial Qt 6 release of Qt TextToSpeech in Qt 6.4, one of the most frequent request we got was that the framework would be significantly more useful if it could generate PCM data with the generated speech, in addition to playing the speech on the audio device. With Qt 6.6, we have added that functionality to the QTextToSpeech::synthesize C++ API. Call that function with a lambda to receive the PCM data for further processing. Other improvements include better control over the queueing of text segments, query-APIs to find matching voices, and an API to check which capabilities the current engine supports. For more details, see the blog post.
在Qt 6.4中首次发布Qt TextToSpeech之后,我们得到的最频繁的请求之一是,如果该框架除了在音频设备上播放语音外,还可以用生成的语音生成PCM数据,那么它将更加有用。通过Qt 6.6,我们将该功能添加到了QTextToSpeech::synthesis C++API中。用lambda调用该函数以接收PCM数据以进行进一步处理。其他改进包括更好地控制文本段的排队,查询API以查找匹配的语音,以及使用API检查当前引擎支持哪些功能。有关更多详细信息,请参阅博客文章。
asyncio
and better tooling(A follow up post will highlight more details on the Qt for Python release)
(后续文章将重点介绍Qt for Python版本的更多细节)
Python supports asynchronous operations through coroutines, and asyncio
is the best-known package for implementing support for the respective keywords and event-loop integrations. Qt 6.6 adds support for asyncio
as technology preview, making sure that Qt's processing of events does not collide with the task processing in asyncio
.
Python通过协程支持异步操作,asyncio是实现对相应关键字和事件循环集成的支持的最著名的包。Qt 6.6添加了对asyncio的支持作为技术预览,确保Qt对事件的处理不会与asyncio中的任务处理发生冲突。
Qt Creator now finds, adds, and updates existing virtual environments, installs wheels, and allows a new virtual environment for each new Python project.
Qt Creator现在可以查找、添加和更新现有的虚拟环境,安装轮子,并为每个新的Python项目提供一个新的虚拟环境。
Users of the Qt Installer will be able to install Qt for Python wheels as part of the regular Qt installation. In addition, commercial Qt for Python wheels will be installable easily with the new qtpip
tool. Users that need to install Qt for Python wheels will be able to use qtpip
as easily as regular pip
to do so.
Qt安装程序的用户将能够安装用于Python轮子的Qt,作为常规Qt安装的一部分。此外,使用新的qtpip工具,可以轻松安装用于Python轮子的商业Qt。需要为Python轮子安装Qt的用户将能够像使用普通pip一样轻松地使用qtpip。
And last but not least, Qt for Python is now compatible with AArch64, which makes Qt for Python available on 64bit embedded systems.
最后但同样重要的是,Qt for Python现在与AArch64兼容,这使得Qt for Python可以在64位嵌入式系统上使用。
Qt for Android now supports Android 13 and uses AndroidX by default. The Supported SDK level is now at 33, matching the Play Store requirement.
Qt for Android现在支持Android 13,并默认使用AndroidX。支持的SDK级别现在为33,符合Play Store的要求。
On the desktop, we have been working on Windows and Linux support for ARM architecture. The Qt 6.6 distribution does not include binary packages for those platforms, but you can make your own build of Qt 6.6 for those platforms using the same process as for x86 architecture. With Qt 6.7 we plan to make official ARM packages available for all desktop operating systems.
在桌面上,我们一直致力于Windows和Linux对ARM架构的支持。Qt 6.6发行版不包括用于这些平台的二进制包,但可以使用与x86体系结构相同的过程为这些平台构建自己的Qt 6.6。通过Qt 6.7,我们计划为所有桌面操作系统提供正式的ARM软件包。
For Embedded systems, we have upgraded the Yocto support to the latest "Mickledore" release, and we have been working with a range of hardware vendors to provide pre-built Boot2Qt packages for NXP boards, the Renesas R-Car device, and various other platforms. Device creators that maintain their own Qt Board Support Package will benefit from enhancements in the QBSP Test Bench when making sure that Qt tests are all green.
对于嵌入式系统,我们已将Yocto支持升级到最新的“Mickledor”版本,并且我们一直在与一系列硬件供应商合作,为恩智浦板、瑞萨R-Car设备和各种其他平台提供预构建的Boot2Qt包。当确保Qt测试全部为绿色时,维护自己的Qt板支持包的设备创建者将受益于QBSP测试台的增强功能。
We have continued our work with the Debian project, and established a new Qt 6 maintainer group. Thanks to this collaboration we now have Qt 6 packages available for Debian 11 and Debian 12 from the regular distribution repositories. Commercial Qt 6.6 packages are available from a Debian repository hosted by The Qt Company. Thanks to this work, both Commercial and Open Source users on Debian-based Linux systems can maintain their Qt installation using regular apt-get
workflows. This includes embedded boards that are natively using Debian or Ubuntu distributions, such as the Raspberry Pi 4.
我们继续与Debian项目合作,并建立了一个新的Qt6维护小组。由于这次合作,我们现在可以从常规分发存储库中获得适用于Debian11和Debian12的Qt6软件包。商业版Qt 6.6软件包可从Qt公司托管的Debian存储库中获得。由于这项工作,基于Debian的Linux系统上的商业用户和开源用户都可以使用常规的apt-get工作流来维护他们的Qt安装。这包括本机使用Debian或Ubuntu发行版的嵌入式板,如Raspberry Pi 4。
The above is a list of the larger new features, and like every minor release, Qt 6.6 brings many small improvements to existing classes and tools.
上面列出了更大的新功能,和每个小版本一样,Qt6.6对现有的类和工具进行了许多小的改进。
Permission APIs are now available from QML, QWidget got a convenient overload to set the entire focus chain at once, and the Qt containers got assign()
overloads to replace the existing payload without any memory allocations. Many Qt APIs that operate on durations now have overloads for std::chrono, so a timer can be started with a 10s
literal value. Similarly, many APIs that work with time stamps now have overloads taking a QTimeZone
, which can help reduce the amount of costly conversions between UTC and local time, for example when working with file dates.
QML现在提供了权限API,QWidget获得了一个方便的重载,可以同时设置整个焦点链,Qt容器获得了assign()重载,可以在没有任何内存分配的情况下替换现有的有效负载。许多在持续时间上运行的QtAPI现在都有std::chrono的重载,因此计时器可以用10s的文字值启动。类似地,许多使用时间戳的API现在都有占用QTimeZone的重载,这有助于减少UTC和本地时间之间昂贵的转换量,例如在使用文件日期时。
In the Qt Sql module, the folks from Mimer SQL contributed a plugin for their database backend, and the MySQL/MariaDB driver learned about new connect options.
在Qt-Sql模块中,Mimer Sql的人员为他们的数据库后端贡献了一个插件,MySQL/MariaDB驱动程序了解了新的连接选项。
Custom or platform specific clipboard formats can be implemented again, using the new converter classes for macOS and Windows, and the Qt PDF module provides convenient classes for accessing links, get thumbnails of pages, and select pages.
使用macOS和Windows的新转换器类,可以再次实现自定义或平台特定的剪贴板格式,Qt PDF模块为访问链接、获取页面缩略图和选择页面提供了方便的类。
Developers targeting the WebAssembly platform can enjoy faster development cycles, easier debugging, and better maintenance thanks to the support for dynamic linking and improvements to the QtLoader. We continue to work on hardening the support for dynamic linking so that applications can be deployed into production with shared Qt libraries and plugins as well.
由于支持动态链接和对QtLoader的改进,以WebAssembly平台为目标的开发人员可以享受更快的开发周期、更容易的调试和更好的维护。我们继续致力于加强对动态链接的支持,以便应用程序可以通过共享的Qt库和插件部署到生产中。
QML source code that has been compiled no longer has to be included with the application binary, and the QML linter supports extensions for custom rules. Work on the QML language server is continuing, and will be a big step to improving the experience for QML developer in Qt Creator, or any other IDE that supports the language server protocol, such as Visual Studio Code.
已编译的QML源代码不再需要包含在应用程序二进制文件中,QML linter支持自定义规则的扩展。QML语言服务器的工作仍在继续,这将是改善QML开发人员在Qt Creator或任何其他支持语言服务器协议的IDE(如Visual Studio Code)中体验的一大步。
I’d like to thank all the contributors who have helped with making Qt 6.6 a reality. You can find a full list of all community members that landed a patch to the Qt source code at the end of the release notes. And a special Thanks goes to all of you who have helped making Qt better by reporting bugs, sending us your feedback, or by telling us about your use cases. And last but not least, I'd like to thank everyone involved in getting the release out of the door!
我要感谢所有帮助实现Qt 6.6的贡献者。可以在发布说明的末尾找到所有获得Qt源代码补丁的社区成员的完整列表。特别感谢所有通过报告错误、向我们发送反馈或告诉我们用例帮助Qt变得更好的人。最后但同样重要的是,我要感谢所有参与发布的人!
As always, the new release will be available in the Qt installer. You can also get the release from our download page or your Qt Account page, and - as mentioned above - through Debian repositories.
一如既往,新版本将在Qt安装程序中提供。也可以从我们的下载页面或您的Qt帐户页面获得发布,并如上所述,通过Debian存储库获得发布。