Original address: www.qt.io/blog/qt-6.0…

Original author: www.qt.io/blog/author…

Published: Tuesday, December 08, 2020

I am very excited to announce today’s release of Qt 6.0. This is the first release of a new major release and marks an important milestone for Qt. We started with the initial ideas a few years ago, and since then we’ve put a lot of effort into building the next generation of Qt.

Qt 5 has been a huge success over the years, and in the eight years since we released Qt 5.0, our user base and Qt usage have grown tremendously. But the world has changed significantly since 2012. Qt usage in embedded systems has skyrocketed, with the development of C++ and the emergence of new 3D graphics apis. These are all examples of factors that directly affect Qt.

As a cross-platform framework, Qt needs to adapt to these changing requirements. Over the life of Qt 5, we have managed to accommodate many of these requirements well. However, maintaining full source code and binary compatibility in the Qt 5 series prevents certain things from being resolved during its lifetime. With Qt 6, we now have the opportunity to make changes and build Qt better for years to come.

Therefore, Qt 6’s mission is to make Qt the productivity platform of the future. Qt 6.0 is an important release of Qt, giving us greater freedom to implement new features and functions to better support the needs of today and tomorrow. Qt 6.0 is a continuation of the Qt 5 series, and we are focused on keeping users’ migration uninterrupted. I captured these thoughts in a Qt 6 vision blog post about 18 months ago.

In creating Qt 6, we made sure that Qt’s core values were upheld and maintained, including.

  • Its cross-platform nature allows users to deploy their applications to all desktop, mobile, and embedded platforms using a single technology and a single code base.
  • Scalability ranges from low-end single-purpose devices to high-end complex desktop applications or connected systems.
  • Its world-class apis and tools and documentation simplify the creation of applications and devices.
  • Its maintainability, stability, and compatibility enable users to maintain a large code base with minimal effort.
  • Its vast developer ecosystem has more than 1.5 million users.

Qt 6.0 is the first release in the Qt 6 series that meets new market needs while maintaining our core values.

In developing Qt 6, we took a deep look at some of the most core parts of Qt to determine how they could be improved. We identified several core areas of focus and spent a lot of time improving them. These areas include

  • Using c + + 17
  • The next generation of QML
  • New Graphics architecture
  • Unified 2D and 3D Qt fast
  • CMake builds the system (applications still support Qmake).

Of course, we took the time to make a lot of improvements in other areas, too many to list here, but I would refer you to the wiki page for more details. We will also host a Meet Qt 6.0 webinar covering the Americas /EMEIA and EMEIA/APAC time zones. But let’s take a look at some of the highlights.

C++17

In Qt 6, we now need a compiler that is compatible with C++17, allowing us to use more of the modern C++ language constructs when developing Qt, while also allowing for API integration.

Core libraries and apis

Qt Core has done a lot of work because it is the module that implements the Core part of Qt. We have improved in many ways. Just a few core examples.

  • New properties and binding system: this system now brings the binding concepts that QML was so successful with in Qt 5 out of C++.
  • Strings and Unicode. In Qt 5, we started to fully integrate Qt with Unicode, and we got a lot of work done, but there were still some items we needed to clean up in Qt 6. More details will follow in a separate blog post.
  • In Qt 5, QList has been a frequently criticized class because it allocates objects larger than Pointers stored in the heap, causing stress to the heap allocation method. In Qt 6, we changed this, unifying QList and QVector into a single class. See our blog post QList in Qt 6 for more details.
  • QMetaType and QVariant are the basis of our Qt meta-object system. Signals and slots cannot be implemented without QMetaType, and QVariant is required for dynamic calls. These two classes have been almost completely rewritten in Qt 6, and you can read the details here.

Other parts of Qt that have nothing to do with graphics have also changed a lot. For example, Qt Concurrent has done an almost complete rewrite that now makes the development of multithreaded applications easier than ever. Qt Network has also undergone a number of cleanups and improvements. See this blog post for details.

New Graphics architecture

Qt 5’s graphics architecture relies heavily on OpenGL as the underlying 3D graphics API. While this was the right thing to do when we created Qt 5 in 2012, the market around us has changed significantly over the past few years with the introduction of Metal and Vulkan. We now have a large set of different graphics apis that are commonly used on different platforms. As Qt is a cross-platform framework, this of course means that we have to make adjustments to ensure that our users can run Qt at maximum performance on all platforms.

Thus, when Qt 5 relied on OpenGL for hardware-accelerated graphics, Qt 6 completely changed. All 3D graphics in Qt Quick are now built on top of a new 3D graphics abstraction layer called RHI (Rendering Hardware Interface). RHI enables Qt to use the native 3D graphics API of the underlying operating system/platform. As a result, Qt Quick will now use Direct3D on Windows and Metal by default on macOS. See the series of posts on RHI for details.

The OpengL-specific classes in Qt still exist, but are now removed from QtGui and placed in the QtOpenGL module. We’ve also added a new module called QtShaderTools that handles the different coloring languages of these 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’s 3D capabilities. For Qt Quick 3D, our focus was to create an API that was 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 is to achieve seamless integration between 2D and 3D content.

This module has been significantly improved in Qt 6, which we were unable to do in the Qt 5 series. Most importantly, it now always uses the RHI abstraction layer to optimize the use of the underlying graphics API and hardware. In addition, it now features deeper and more high-performance integration between 2D and 3D content, allowing you to drop 2D items into 3D scenes. It also greatly improves support for glTF2 and physics-based rendering, making it easy to import assets created in other design tools. There are many other major improvements to the module, and a more in-depth description can be found in a separate blog post.

Qt 3D is now also based on the RHI abstraction layer and has had some performance improvements and cleanups. You can find more details in two blog posts from our partner KDAB (here and here).

Qt Quick’s desktop styling

When we created this set of controls for Qt Quick, our focus was to make them lightweight and high-performance, so they don’t support desktop style in Qt 5. In Qt 6, however, we found a way to make them look and feel native on the desktop operating system. In 6.0, Qt Quick now supports native styles on macOS and Windows. See this blog post for details. In Qt 5, the native look and feel for Android and Linux already exists through the Material and Fusion styles, and we are working on improving these styles for future Qt releases, as well as planning to implement native styles for iOS.

Interface to platform-specific functionality

Even though Qt provides most of the functionality needed to develop applications, there are times when you need to interface with platform-specific functionality. In Qt 5, we provide a set of additional modules (QtX11Extras, QtWinExtras, QtMacExtras) to help with this purpose. But this complete separation from the rest of Qt has led to some architectural problems, inconsistencies, and code duplication within Qt. In Qt 6, we tried to clean up these issues and fold the functionality provided by these additional modules into platform-specific apis provided directly in Qt. This will make it easier to interface with OS/platform-specific apis in Qt 6. See here for more details.

Build the system and package

We’ve also made some pretty big changes to the way we build and release Qt. It is worth mentioning that Qt 6 itself is now built using CMake. This is also a significant improvement for all of us who use CMake to build projects. We will continue to support Qmake for the life of Qt 6, so there is no need to make any changes to your build system if you are using Qmake, but we recommend using CMake for all new projects.

Qt 6 also comes with a much smaller default package, and many add-ons are now distributed as separate packages through the package manager. This gives us more flexibility to adjust the release schedule of add-ons to the needs of the market, for example, releasing features more frequently like the core Qt package, or having them work with multiple Qt versions simultaneously. In addition, we can use package managers as delivery channels for third-party content. Finally, it gives our users more flexibility because they can choose to download only what they really need.

Currently, we use the existing Qt installer as the back end of the package manager, but are working on alternatives for future versions. See the blog post here for more details.

compatibility

In making changes to Qt 6, we tried to adapt our API to what we thought would be needed in the future, while minimizing disruption to existing users. While your code needs to be tweaked to use Qt 6 as much as possible, we’ve tried to make migrating to the new version as easy as possible.

The first thing we did was clean up our code base. During the life of Qt 5, we abolished a number of apis and even entire modules. The first thing we did was remove these in order to provide a leaner service for future Qt and allow us to leave behind something that doesn’t make sense today.

However, we have been careful to mark as many of these apis as possible as deprecated in Qt 5.15. Enabling deprecation warnings and cleaning up these apis will make your code base compatible with Qt 6.

Some of the most commonly used apis that were removed in Qt5 have been moved to the Qt5CoreCompat module. It contains some of the most widely used classes in Qt 6, such as QRegExp, QTextCodec, the old SAX parser for XML, and other projects. This module is intended as a porting aid and will not receive bug fixes except for Qt 5 regression and security-related issues. We recommend that you use it for migration, but then gradually remove your dependency on the module.

If you want to start porting to Qt 6, we have more detailed porting guidelines in our documentation.

Supported Platforms

Qt has always been cross-platform, and will continue to be so in Qt 6. Qt 6.0 support

  • Windows 10
  • MacOS 10.14 and later
  • Linux (Ubuntu 20.04, CentOS 8.1, OpenSuSE 15.1)
  • IOS 13 or later
  • Android (API level 23 or newer

On the embedded side, we support a variety of embedded devices running Linux. Qt 6 does not yet support any of the embedded real-time operating systems that Qt 5 supports. Both QNX and INTEGRITY have recently added support for C++17, and we plan to add support for them when Qt 6.2 is released.

Looking forward to

Qt 6.0 also does not support many additional modules that can be found in Qt 5.15. This was deliberately decided to free up time to ensure that we could complete all the changes we needed to make to the basic modules of the Qt framework.

We are now working on bringing most of these add-ons to Qt 6. We’ve done a lot of work, and we expect to have support for most of the add-ons back when Qt 6.2 is released. A number of add-ons have been compiled for Qt 6, but they have not been officially released yet because there is still some cleanup and refactoring to be done. We plan to port most of the important add-ons when we release Qt 6.2. You can get a complete overview of our add-on support for Qt 6.0 and beyond in the following blog post.

In addition to porting the missing add-ons to Qt 6, much of our work related to Qt 6 in the coming months will focus on stability in the new version and making the new properties system more widely available in Qt.

We have adjusted our Qt 6.1 and 6.2 release schedules and plan to release Qt 6.1 in April. After that, we plan to release the first long-term support version of the Qt 6 series, Qt 6.2LTS, in late September.

While we’re not done for the year, you can also expect a new version of Qt Creator and Qt Design Studio to be released before Christmas! Both products will have full Qt 6 support.

conclusion

Qt 6.0 is the starting point for the next generation of Qt. It’s not quite as fully featured as 5.15, but we’ll be filling in those gaps in the coming months. We have done a lot of important work to lay the groundwork for the next version of Qt. Many of these changes may not be immediately apparent, but I firmly believe they will help keep Qt competitive for years to come.

I would like to thank everyone who helped make Qt 6.0 possible. More than 250 people contributed code during the development of Qt 6, and thousands more helped complete bug reports and provided feedback. Qt 6 would not be where it is today without you. Thank you so much for all your hard work.

Finally, I hope you enjoy everything Qt 6 has to offer. If your favorite modules haven’t been ported yet, don’t worry, we’re working on these issues. Please go to our website or your Qt account to download the new version. Let us know what you think and we appreciate all feedback to help us make subsequent releases even better.


Translation via www.DeepL.com/Translator (free version)