I am really excited to announce today’s release of Qt 6.0. It is the first release of a new major version, and marks a major milestone for Qt. We started working on the initial ideas a few years ago, and since then, have put a massive effort into creating the next generation of Qt.
Qt 5 has been a fantastic success over the years, and we have seen an enormous growth of our user base and Qt usage over eight years since we released Qt 5.0. But the world has undergone significant changes since 2012. Qt usage in embedded systems has skyrocketed, C++ has evolved, and new 3D graphics APIs have emerged. These are examples of factors that have directly affected Qt.
As a cross-platform framework, Qt needs to adjust to those changing requirements. We have managed to adapt very well to many of those requirements during the lifetime of Qt 5. However, maintaining full source and binary compatibility within the Qt 5 series made certain things impossible to fix within its lifetime. With Qt 6, we now have the opportunity to make changes and build Qt to be better suited for the years to come.
Thus, the mission of Qt 6 is to enable Qt to be the productivity platform for the future. Qt 6.0, as a major release of Qt, gave us a higher degree of freedom to implement new features, functionality, and better support today and tomorrow’s requirements. Qt 6.0 is a continuation of the Qt 5 series, and we have focused on making migration non-disruptive for users. I published a Qt 6 vision blog post capturing those ideas around 18 months ago.
When creating Qt 6, we ensured that Qt’s core values have been adhered to and upheld, including:
- Its cross-platform nature, allowing users to deploy their applications to all desktop, mobile, and embedded platforms using one technology and from a single codebase
- Its scalability from low-end, single-purpose devices to high-end complex desktop applications or connected system
- Its world-class APIs and tools and documentation, simplifying the creation of applications and devices
- Its maintainability, stability, and compatibility, allowing users to maintain large codebases with minimal effort
- Its large developer ecosystem with more than 1.5 million users
Qt 6.0 is the first release of the Qt 6 series addressing new market demands while keeping the core values at the heart of what we do.
When developing Qt 6, we had an in-depth look at some of Qt’s most central parts to identify how we could improve them. We discovered a couple of core focus areas that we invested considerable time in improving. Those areas include:
- Leveraging C++17
- Next generation QML
- New graphics architecture
- Unified 2D and 3D for Qt Quick
- CMake build system (with qmake still supported for applications)
We have of course also spent time doing numerous improvements in other areas, too many to mention them all here, and I suggest you look at the more detailed wiki page. We are also hosting Meet Qt 6.0 webinar sessions covering the Americas/EMEIA and EMEIA/APAC time zones. But let’s take a look at some of the highlights.
C++17
With Qt 6 we now require a C++17 compatible compiler enabling the use more modern C++ language constructs when developing Qt and also allows for integration points on the API side.
Core libraries and APIs
Much work has gone into Qt Core, as it is the module that implements the most central parts of Qt. We’ve gone through many areas there and made improvements. To name some of the most central ones:
- The new property and binding system: This system now brings the concept of bindings that made QML such a huge success in Qt 5 available from C++.
- Strings and Unicode: With Qt 5, we started aligning Qt fully with Unicode, where we completed a lot of the work, but a few items remained that we now cleaned up for Qt 6. More details will come in a separate blog post later on.
- QList has been a class that was often criticized in Qt 5, as it was heap allocating objects stored in there that were larger than a pointer, leading to pressure on heap allocation methods. In Qt 6, we changed this and unified QList and QVector into one class. See our blog post about QList in Qt 6 for details.
- QMetaType and QVariant are fundamental to how our Qt’s meta-object system works. Signals and slots would not be possible without QMetaType and QVariant is required for dynamic invocations. Those two classes got an almost complete rewrite with Qt 6, and you can read about the details here.
Other parts of Qt that are not related to graphics have also seen large changes. For example, Qt Concurrent has undergone an almost complete rewrite and now makes development of multi-threaded applications more effortless than ever. Qt Network has seen lots of clean-up and improvements. See this blog post for details.
New graphics architecture
The graphics architecture of Qt 5 was very much dependent on OpenGL as the underlying 3D graphics API. While this was the right approach in 2012 when we created Qt 5, the market around us has changed significantly over the last couple of years with the introduction of Metal and Vulkan. We now have a large set of different graphics APIs that are commonly being used on different platforms. For Qt as a cross-platform framework, this, of course, meant that we had to adjust to this and ensure our users can run Qt on all of them with maximum performance.
So while Qt 5 relied on OpenGL for hardware-accelerated graphics, the picture completely changes with Qt 6. All of our 3D graphics in Qt Quick is now built on top of a new abstraction layer for 3D graphics called RHI (Rendering Hardware Interface). RHI makes it possible for Qt to use the native 3D graphics API of the underlying OS/platform. So Qt Quick will now use Direct3D on Windows and Metal on macOS by default. For details, have a look at the blog post series about the RHI.
The OpenGL specific classes in Qt still exist, but are now moved out of QtGui in the QtOpenGL module. We also added a new module called QtShaderTools to deal with the different shading languages of those APIs in a cross-platform way.
Qt Quick 3D and Qt 3D
Qt Quick 3D is a relatively new module. It seamlessly extends Qt Quick with 3D capabilities. With Qt Quick 3D, our focus was to create an API that is as easy to use as the existing parts of Qt Quick (for 2D user interfaces) while providing full support for creating complex 3D scenes. The main goal behind this effort has been to enable seamless integration between 2D and 3D content.
This module has seen significant improvements with Qt 6 that we wouldn’t have been able to do in the Qt 5 series. Most importantly it is now always using the RHI abstraction layer to make optimal use of the underlying graphics API and Hardware. Additionally, it now features a much deeper and more performant integration between 2D and 3D content, allowing you to place 2D items into a 3D scene. It also has vastly improved support for glTF2 and physics-based rendering, making it trivial to import assets created in other design tools. There are many other major improvements in the module, a more in-depth description can be found in a separate blog post.
Qt 3D is now also based on top of the RHI abstraction layer, has seen some performance improvements and cleanups. You can find more details in two blog posts by our partner KDAB (here and here).
Desktop styling for Qt Quick
When we created the set of controls for Qt Quick, our focus was to make them lightweight and performant. For that reason, they did not support desktop styling in Qt 5. However, in Qt 6, we found a way to make them look & feel native on desktop operating systems. With 6.0, Qt Quick now supports native styling on both macOS and Windows. See this blog post for details. Native look & feel for Android and Linux already existed with the Material and Fusion styles in Qt 5. We are improving those for future Qt releases and are also planning to implement a native style for iOS.
Interfacing with platform specific functionality
Even with Qt offering most functionality required to develop your application platform-independently, there is sometimes a need to interface with platform-specific functionality. In Qt 5, we provided a set of add-on modules (QtX11Extras, QtWinExtras, QtMacExtras) to help with this purpose. But this full separation from the rest of Qt has led to a couple of architectural issues, inconsistencies and code duplication within Qt. In Qt 6, we made an effort to clean this up and fold the functionality offered by those add-on modules into platform specific APIs offered directly in Qt. This will make interfacing with OS/platform-specific APIs much easier in Qt 6. Have a look here for more details.
Build system and Packaging
We also made some considerable changes in how we build and distribute Qt. Worth mentioning is that Qt 6 itself is now built using CMake. This has also led to significant improvements for all our users that use CMake to build their projects. We will continue to support qmake for the lifetime of Qt 6, so there is no need to make any changes to your build system if you’re using it, but we recommend to use CMake for all new projects.
Qt 6 also comes with a much smaller default package, and many of the add-ons are now distributed as separate packages through a package manager. This gives us more flexibility in adapting release schedules of add-ons to market requirements, allowing, for example, for more frequent feature releases as the core Qt packages or making them available for multiple Qt versions at the same time. In addition, we can use the package manager as a delivery channel for 3rd party content. And finally, it gives our users more flexibility as they can choose to download only what they really need.
Currently, we are using the existing Qt installer as the backend for the package manager, but are investigating alternatives for future releases. See the blog post here for more details.
Compatibility
When making changes for Qt 6, we’ve tried to adjust our APIs to what we believe is required for the future while at the same time trying to break as little as possible for our existing users. While your code will need some adjustments to make the best possible use of Qt 6, we have tried to make porting to the new version as easy as possible.
One of the first things we did was to clean up our codebase. During the lifetime of Qt 5, we deprecated quite a few APIs and even entire modules. The first thing we did was to remove those to get to a leaner Qt for the future and allow us to leave some things behind that do not make sense anymore today.
However, we have taken care to mark as many of those APIs as possible as deprecated in Qt 5.15. Enabling deprecation warnings there and cleaning those up will bring you a long way towards making your codebase compatible with Qt 6.
Some of the most used APIs that have been removed in Qt 5 have been moved into a Qt5CoreCompat module. It contains a couple of widely used classes that have been removed from Qt 6, such as QRegExp, QTextCodec, the old SAX parser for XML, and a few other items. The intention of this module is meant as a porting help and will not receive bug fixes, apart from regressions against Qt 5 and security related problems. We recommend that you use it for porting but then incrementally remove your dependencies to the modules.
If you want to start porting to Qt 6, we have a much more detailed porting guide in our documentation.
Supported platforms
Qt has always been a cross-platform, and that will continue in Qt 6. Qt 6.0 supports
- Windows 10
- macOS 10.14 and newer
- Linux (Ubuntu 20.04, CentOS 8.1, OpenSuSE 15.1)
- iOS 13 or newer
- Android (API level 23 or newer)
On the embedded side, we support a wide range of embedded devices running Linux. Qt 6 does not yet support any of the embedded real-time operating systems supported in Qt 5. Both QNX and INTEGRITY have recently added support for C++17, and we plan to add support for them by the time we release Qt 6.2.
Outlook
Qt 6.0 does not yet support many of the add-on modules that can be found in Qt 5.15. This was intentionally decided to free up time to ensure that we could complete all the changes we needed to make for the Qt framework’s essential modules.
We are now in the working on bringing most of those add-ons over to Qt 6. We have already done a lot of work, and we expect to have most add-ons supported again by the time we release Qt 6.2. Many add-ons already compile already against Qt 6, but they are not yet officially released as some cleanup work and refactoring remains to be done. We plan to have most of the important add-ons ported by the time we release Qt 6.2. Get a full overview of our add-on support in Qt 6.0 and beyond in the following blog post.
Apart from porting the missing add-ons over to Qt 6, a lot of our Qt 6 related work in the next coming months will focus on the stability of the new releases and taking the new property system into more wide-spread use within Qt itself.
We have adjusted our release timelines for Qt 6.1 and 6.2, and are planning to release Qt 6.1 already in April. After that, we plan to release our first long term supported version in the Qt 6 series, Qt 6.2 LTS, by the end of September.
And we are not yet done for this year, and you can also expect a brand new version of Qt Creator and Qt Design Studio to be released before Christmas! Both will come with full support for Qt 6.
Summary
Qt 6.0 is a starting point for the next generation of Qt. It is not yet as feature-complete as 5.15, but we will fill the gaps within the months to come. We’ve done a lot of important work in laying out the foundations of the next version of Qt. Many of those changes might not be immediately visible, but I firmly believe they will help keep Qt competitive in the years to come.
I want to thank everybody who helped make Qt 6.0 possible. More than 250 people have contributed code during the development of Qt 6, and thousands have helped with bug reports and provided feedback. Qt 6 would not be what it is today without you. Thank you so much for all your hard work!
Finally, I hope you all like what you see with Qt 6. Don’t worry if your favorite module has not been ported over yet, we’re working on those. Please go and download the new version from our website or your Qt Account. Let us know what you think, we appreciate all feedback to help us make the follow up releases even better!
转自 https://www.qt.io/blog/qt-6.0-released
都出6了,还在用4.8呢