New Features in Qt 6.0

From Qt Wiki
Revision as of 12:08, 5 November 2020 by Agocs (talk | contribs) (Added shadertools to New Modules)
Jump to navigation Jump to search

The product 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, provides 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 should not be disruptive for users to migrate on.

When creating Qt 6, we have especially wanted to ensure that the core values that Qt has for our customers and users are adhered to:

  • Its cross-platform nature, allowing users to deploy their applications to all desktop, mobile, and embedded platforms using one technology and from a single code base
  • Its scalability from low-end, single-purpose devices to high-end complex desktop applications or connected system
  • World-class APIs and tools and documentation, simplifying the creation of applications and devices
  • Maintainability, stability, and compatibility, allowing to maintain large code bases with minimal effort
  • A 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're doing.

Porting guide

When creating Qt 6, we aim to retain as much compatibility with Qt 5 as possible, but some changes were inevitable to make Qt a better framework. To make it easier to port to Qt 6.0, we have created a Porting guide to summarize those changes and provide guidance to handle them. In the guide, you can find links to articles about changes that may affect your application and help you transitioning from Qt 5 to Qt 6.

Overview of the changes

Key changes in Qt 6.0 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)
  • Multiple improvements throughout

With Qt 6.0 focus is in the most commonly used modules, so many of the add-ons are not yet available with Qt 6.0.

New Features (within existing modules)

There have been lots of clean-up rounds, and we have removed many deprecated methods. The Qt 6 documentation snapshot pages, automatically generated by QDoc based on the code, include Obsolete Classes and New Classes and Functions lists.

Within QtCore

  • QByteArrayView now provides a light-weight way to view the content of a QByteArray or other char-equivalent array data
  • QPromise allows setting values, progress and exceptions to QFuture
  • QFuture supports attaching continuations
  • Signals can now be converted to QFuture objects
  • QVector and QList are unified. QList is updated and should be used by default when array-like behaviour is needed
  • QList, QString and QByteArray now have optimized complexity of insertion at the beginning (a.k.a. prepend)
  • Q_DECLARE_TYPEINFO() mechanism simplified:
    • Trivially copyable and trivially destructible types are automatically treated as relocatable (Q_RELOCATABLE_TYPE)
    • Q_MOVABLE_TYPE and Q_RELOCATABLE_TYPE mean the same thing
  • Container classes now use qsizetype as an underlying type for size and indexing. Additionally, several related classes got updated in a similar fashion (e.g. QTextBoundaryFinder and QRegularExpression). This change allows containers to hold more than 2^31 items on 64 bit platforms
  • QLocale improvements, principally around number formatting (plus lots of clean-up).
    • A few QChar-returning methods now return QString to cope with locales where the relevant "single character" is represented by a code-point outside Unicode's BMP (Basic Multilingual Plane); that is, they use surrogate pairs in UTF-16, hence two code-units in the encoding Qt uses, rather than only one.
    • That enables support for number formatting and parsing in locales whose numerals are not in the BMP, making it possible now to include such locales, where CLDR has data for them.
    • Corrections to grouping of digits (a.k.a. placement of "thousands separators", except that …) so that locales which group other than in threes are properly covered, and a leading separator is omitted if there are too few digits before it, as required by some locales (e.g. Spanish).
    • Use of accountancy formats for currency quantities, where available, improving support for locale-specific representation of negative currency quantities.

Qt Quick

  • The Qt Quick scenegraph is now functional on Vulkan, Metal, and Direct3D 11, in addition to OpenGL and OpenGL ES.
    • APIs with direct OpenGL dependencies are replaced by new alternatives, that are functional with all the supported graphics APIs. This affects mainly a number of member functions in QQuickWindow, QSGTexture, and QSGMaterialShader.
    • The Qt Quick scenegraph material system has changed to accomodate graphics APIs other than OpenGL. QSGMaterialShader has a whole new interface to be implemented by subclasses.
    • QQuickRenderControl has an enhanced API and is complemented by the new helper classes QQuickRenderTarget, QQuickGraphicsDevice, and QQuickGraphicsConfiguration, which provide better control over QQuickWindow and the underlying graphics stack.
  • QQuickWindow has a number of new signals, such as beforeRenderPassRecording() or beforeFrameBegin(). These complement the existing signals, such as beforeRendering(), and enable applications to perform their own Vulkan, Metal, D3D, or OpenGL rendering before or after the Qt Quick scenegraph renders its scene.
  • Vertex and fragment shaders in ShaderEffect and QSGMaterialShader are handled via the new unified shader pipeline, allowing shaders to be written once, while being functional with any of the supported graphics APIs at run time. Applications should now use the tools from the Qt Shader Tools module to prepare (compile, reflect, and translate) their shader code offline or at build time.
  • The Qt Quick scenegraph renderer is now able to function in a mode that is compatible with perspective projections as well, which enables rendering combined 2D-3D scenes in one render pass.

Qt Quick 3D

  • Ported to the new common graphics abstractions in Qt 6.0.
    • In Qt 6.0 everything that applies to Qt Quick in this regard (for example, configuring which graphics API to use) applies to Qt Quick 3D as well. The 3D scene renderer plugs in to Qt Quick, using the same rendering infrastructure, unlike Qt 5.15, where rendering happened in separate worlds by going directly to OpenGL.
  • More unified 2D-3D scenes.
    • A 3D scene can contain arbitrary Item (QQuickItem) subtrees, which are then rendered directly by the Qt Quick scenegraph's renderer, using the appropriate transformations and projections, without having to do a separate render pass into some offscreen render target.
  • Improved rendering fidelity
    • Improved PrincipledMaterial: assets with the metallic-roughness workflow now look closer to what the designer intended.
    • Enhanced color handling (linear vs. sRGB), with proper tonemapping.
  • The custom material system has been completely redesigned. The CustomMaterial API and the way the associated shader snippets are written have major changes in Qt 6.0. See also the getting started page.
  • Post-processing effects have been migrated to a shader handling approach that follows the same patterns as CustomMaterial, making writing custom effects simpler.
  • Texture parameters (filtering, mipmaps) are now configurable via the QML API.
  • Added a C++ API for procedurally generating image data for textures.
  • Updated the custom geometry C++ API.
  • The documentation has been heavily updated. Also added architecture documentation and getting started guides.

New Modules

Qt5Compat
Compatibility library providing access to legacy APIs removed in Qt 6.
QtShaderTools
Tools and APIs for preparing graphics and compute shaders to be consumed by the new graphics stack

Platform Changes

All

  • Qt is now built with CMake.
  • Qt High DPI scaling is now activated by default; the default rounding policy is PassThrough

Linux

macOS

Windows

Removed Modules

The following modules are removed and not planned to be developed further. Other modules that are not part of Qt 6.0 are considered for candidates to support with later Qt 6.x releases or as additional libraries on top of the baseline Qt release.

  • Qt Multimedia Widgets
  • Qt Graphical Effects
  • Qt Purchasing
  • Qt Quick Extras
  • Qt Quick WebGL
  • Qt Script
  • Qt XML Patterns

See Checklist for Qt 6.0 inclusion for the selection process.

Code from these Qt <platform> Extras modules will find new homes in more relevant modules over time, and any remaining APIs considered for inclusion in later 6.x releases:

  • Qt Android Extras
  • Qt Mac Extras
  • Qt X11 Extras

Additional Modules Available via Package Manager

The following additional modules are available via the package manager functionality in the Qt online installer:

  • Qt Image Formats
  • Qt 3D
  • Qt Network Authorization

The package manager provides these additional modules as source packages, which need to be built locally by the user.