New Features in Qt 6.1

From Qt Wiki
Revision as of 11:45, 19 March 2021 by Agocs (talk | contribs) (add note about graphical effects)
Jump to navigation Jump to search

New & Restored Modules

The following additional modules are available, that were not present in 6.0:

  • Active Qt
    • Qt's ActiveX and COM support allows Qt for Windows developers to:
      • Access and use ActiveX controls and COM objects provided by any ActiveX server in their Qt applications.
      • Make their Qt applications available as COM servers, with any number of Qt objects and widgets as COM objects and ActiveX controls.
    • Qt Charts still supports only OpenGL for accelerated series (AbstractSeries.useOpenGL). Such series will not render in Qt Quick if another graphics API is used for rendering.
  • Qt Data Visualization
    • Qt Data Visualization supports only OpenGL RHI backend, and requires setting of the environment variable QSG_RHI_BACKEND to opengl. This can either be done on system level, or defined in the application main with qputenv("QSG_RHI_BACKEND", "opengl");
  • Qt Device Utilities
    • Support for networking functionalities only
  • Qt Graphical Effects
    • While the module is not shipped with Qt 6, a number of effects are ported to the new graphics architecture and are added to the Qt5Compat module. For example, to gain access to DropShadow, add the QML import Qt5Compat.GraphicalEffects. Some complex effects relying on dynamic shader generation, such as, a number of blur variants, have been removed.
  • Qt Lottie
    • The Qt Lottie module has been ported to Qt 6 and the CMake build system
  • Qt State Machines
    • The newly available Qt State Machines package will contain both the Qt SCXML module and the Qt StateMachine module.
  • Qt Virtual Keyboard
    • The Qt Virtual Keyboard module has been ported to Qt 6 and the CMake build system.
    • New dictionary manager allows user defined dictionaries (e.g. phone book) to be implemented by the application.
    • New properties in VirtualKeyboardSettings.
    • Support for Cerence Handwriting (T9 Write) and XT9.

The modules are available as sources in the online installer under "Additional libraries". They need to be compiled first, e.g. using the conan installation that is part of the online installer.

New Features (within existing modules)

QtCore

  • QFuture has new convenience functions to create futures in various states; and can now invoke its continuation in a context object's thread.
  • qfloat16 can be constructed uninitialized
  • <QMath> provides qHypot(), generalising std::hypot() to arbitrarily-many arguments and supporting qfloat16 arguments.
  • Overflow-safe arithmetic is now supported by functions qAddOverflow(), qSubOverflow(), qMulOverflow()
  • removeIf() methods and erase_if() support are extended to more classes
    • QHash, QMap and their Multi variants, whose predicates take either a std::pair or the container's own iterator.
    • QSet, which also gains an insert() overload that takes (but, for now, ignores) a location hint, for compatibility with stl.
    • QString, QByteArray and QList, which also gain erase() support to remove all instances of a specified value
    • QVarLengthArray, along with erase() support and methods removeAll() and removeOne()
  • QStringView's API now includes count(), contains(), indexOf(), lastIndexOf(), constBegin(), constEnd()
  • QLocale provides mappings from its enums to ISO codes and back: languageToCode(), scriptToCode(), countryToCode(), codeToLanguage(), codeToScript(), codeToCountry()
  • QSocketNotifier now supports more flexible creation
  • Added QOperatingSystemVersion::version(), QMetaType::hasRegisteredDataStreamOperators(), QUntypedBindble::isReadOnly() whose names hopefully say enough.
  • Added QJniObject and QJniEnvironment as public API (mainly used for Android).
  • Object property bindings

QtGui

  • QColorSpace can now set custom transfer-functions as tables.
  • QTextDocument added setter and getter for the new QUrlResourceProvider class
  • QUrlResourceProvider is a new class introduced to avoid subclassing QTextDocument and overloading loadResource().
  • The Vulkan API wrappers (QVulkanFunctions, QVulkanDeviceFunctions) now expose the Vulkan 1.1 and 1.2 core APIs as well.
    • With relevant new functionality (supportedApiVersion()) added to QVulkanInstance to allow querying the supported instance-level version before instance creation.
  • Added QPainter::VerticalSubpixelPositioning hint. This is currently only supported on the Freetype font backend, and when available it will enable subpixel positioning of text in vertical direction at the expense of some memory and additional work. For most use cases, this should be left off, but it can be useful for very specific cases where you want to align painted elements vertically on a dynamically transformed painter.

QtWidgets

  • QLabel added setter and getter for the new QUrlResourceProvider class

QtNetwork

  • QNetworkCookie now supports the SameSite feature
  • Support for SSL plugins added (private API for now)
  • Introduced QNetworkInformation
    • QNetworkInformation currently exposes the reachability of the system, using system API.
    • Currently supports Darwin, Windows, Android, and NetworkManager on Linux.

QtQml

  • Added QJSPrimitiveValue and QJSManagedValue for a more fine-grained control over JavaScript execution than it was possible with QJSValue alone.
  • The qt6_add_qml_module CMake function (still in TechPreview) adds a qmllint target, which runs qmllint on the target's QML files.

QtQuick3D

  • Technology preview: "Instanced Rendering", an optimized way of drawing multiple instances of the same objects with different transformations. This feature is considered feature-complete, but may still undergo minor API changes based on user feedback. It is planned for finalization in Qt 6.2.
  • Technology preview: 3D Particles, an API for adding particle effects to 3D scenes. This API is ready for testing, but is not yet feature-complete.
  • Qt Quick 3D now supports morph target animations, i.e. animations where all vertices interpolate between two sets of positions, giving the impression that one shape is morphing into another.

Platform Changes

Mobile

Android

  • QAndroidJniObject as QJniObject public API

Embedded

Boot to Qt

  • As part of Device Creation license
  • NXP iMX8Mini LPDDR4 target
  • NXP iMX8Nano target

QNX

  • QNX version 7.1 Ubuntu 20.04 host and NXP iMX8QM target

Porting guide

When creating Qt 6, we 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, 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.