Qt 5 Features

This content should be put in qtdoc/doc/src/qt5-intro.qdoc


FIXME To be sorted out

Also we have: QTemporaryDir, Added a
QStringLiteral macro, and C++11 support, better logging support through qDebug

Some new add-on modules: jsondb, qgraphicseffects

Qt Essentials

Qt Core


QStandardPaths is a more powerful version of QDesktopServices that was present in Qt 4. Modelled after <a href=“http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKStandardDirs.html”>KStandardDirs</a> from KDE 4, it contains more features, like searching for all occurrences of a given file in the storage locations.


QMimeDatabase offers the functionality of determining the mimetype for a given file
or memory buffer, from extension and/or from the contents.

The MIME type database is provided by the freedesktop.org shared-mime-info
project. If the MIME type database cannot be found on the system, as is the case
on most Windows and Mac OS X systems, Qt will use its own copy of it.

JSON support

QtCore now includes a set of classes for parsing and generating JSON documents. Those classes allow you to convert between in memory binary representation of JSON to standard textual JSON format. The goal is to make common operations on JSON fast.

Compile-time checking for signal-slot connections

QObject now supports an additional syntax for connecting signals to slots that forces the compiler to check that both the signal and the receiver exist, and that their arguments are compatible.

The syntax allows connecting a signal to any kind of C++ receiver, including C++11 lambdas, member functions, or static functions. The receivers no longer need to be declared as slots.

Perl-Compatible Regular Expressions

A new class called QRegularExpression is provided that supports regular expressions compatible with Perl. This class is more powerful and faster than QRegExp, and supports more features, like lazy and possessive quantifiers, lookbehinds, named capturing groups and iteration of matches.


New enabler classes for windowing and rendering

A new set of enabler classes have been added, most importantly QWindow, QScreen,
QSurfaceFormat, and QOpenGLContext. These are now used as backends for the
QtWidgets module, and directly by QtQuick 2.

A set OpenGL classes mostly equivalent to the ones in Qt 4’s QtOpenGL module

Most of the useful Qt OpenGL classes have been polished and moved into
Qt GUI. See QOpenGLFramebufferObject, QOpenGLShaderProgram,
QOpenGLFunctions, etc.

The replacement for QGLContext, QOpenGLContext, is more generic and decoupled
from QWindow, making it support more use cases, such as using the same context
for multiple surfaces.


Instead of having QWindow and QOpenGLFramebufferObject be subclasses of
QPaintDevice, there’s now QOpenGLPaintDevice that can be created on the stack,
making the use of QPainter to render into the currently bound context easier and
more flexible.

Support for additional mouse buttons, often present on “gamer” mouse devices

Qt Applications can now receive Button Events from many more mouse buttons: Up to 27 mouse buttons on XCB, XLIB, or DirectFB; up 16 mouse buttons on Wayland, Evdev, or OS-X; and up to 8 mouse buttons on BlackBerry/QNX. Qt on Windows continues to support only 5 mouse buttons; this is a limitation of the Windows Platform.

Qt Network


It is now possible to lookup DNS records using the new QDnsLookup API.
This does not replace QHostInfo, which is still the API to use for resolving a host name to an IP address.
QDnsLookup is mainly used for other types of DNS record, such as SRV, TXT and MX
This replaces the deprecated Q3Dns API.

Improved support for IPv6 and dual mode networks

Most applications using host names and network layer transparent protocols will gain IPv6 support transparently.
QTcpServer & QUdpSocket bound to QHostAddress::Any will be able to receive both IPv4 and IPv6 connections.
QHostAddress::AnyIPv4 and QHostAddress::AnyIPv6 can be used to bind to only one protocol.
Outgoing http connections using QNetworkAccessManager will attempt both IPv4 and IPv6 connections in parallel, and keep the first to succeed. This will help in environments where one protocol has limited connectivity.

Binding of TCP sockets

QTcpSocket can be bound to an IP address before connecting, which can be used to limit the connection to a specific interface in a multihomed environment.

Removal of QFtp and QHttp APIs

The QHttp API has been removed, due to duplicated functionality.
QNetworkAccessManager can be used instead for nearly all cases.
The QFtp API has been removed as a public API, due to implementation quality.
QNetworkAccessManager can be used to get/put an ftp url.
These APIs will be provided in a standalone form to ease migration.

SSL Certificate Extensions

Support for accessing SSL certificate extensions has been added, this is useful both for developers using the Qt framework, and also as a basis for further development of Qt’s SSL support.

SSL Certificate Verification

Support for verifying an SSL certificate chain programatically, not just when connecting to an SSL server was added.

Workarounds for Buggy SSL Servers

Support for working around buggy SSL servers was added, as can be seen at http://doc.qt.nokia.com/5.0-snapshot/qssl.html#SslOption-enum this allows QSslSocket based code to access legacy systems by enabling bug workarounds etc. This change was backported to Qt 4.8.

Support for opaque Private Keys

This allows applications to read private keys from devices such as PKCS#11 dongles, as illustrated by http://git.iksaif.net/?p=qsslkey-p11.git;a=tree


This is a new module in Qt 5 that provides the QML engine and backend infrastructure.

QML Engine

  • JavaScript engine has changed to V8.
  • Various parser and compiler optimizations have been implemented, as well as a new bindings optimizer.
  • Loading/compilation can now be performed in a separate thread. Enable this by loading a Loader object asynchronously through its source property, or by passing the Component.Asynchronous parameter to Qt.createComponent().
  • New QQmlEngine::trimComponentCache() which safely discards unused data in the engine’s component cache to free memory.

Type System

  • New “var” property type. This is a general-purpose property type which obsoletes the “variant” type. Properties of the “var” type may hold JavaScript references. See “QML Basic Types” for more information.
  • QML properties of type “var” and “variant” can now hold pixmaps. See “Scarce Resources in JavaScript” for more information.
  • ValueType improvements:
    • QColor is now a value type. The red, green, blue and alpha channels of a “color” property can be accessed via “r”, “g”, “b” and “a” properties
    • Improved support for QVector4D, now constructible in QML via Qt.vector4d()
  • Support for certain sequence types (QList<int>, QList<qreal>, QList<bool>, QList<QUrl>, QList<QString> and QStringList) has been improved. QObjects can define Q_PROPERTYs of these types which can be accessed transparently from JavaScript.

Modules and Imports

  • Arbitrary functionality may be provided in a namespace through a Module API. See “qmlRegisterModuleApi()” for more information.
  • JavaScript (.js) files may now import QML modules and other JavaScript files using the “.import” syntax.


  • QQmlExpression can now be constructed directly (and more efficiently) from a QQmlScriptString.
  • The component returned by Qt.createComponent() is no longer parented to the engine. Be sure to hold a reference, or provide a parent.

Qt Quick

This is a new module in Qt 5 which provides the visual canvas and scenegraph backend as well as the QtQuick QML module for QML application development.

Qt Quick 2 is based on an OpenGL scenegraph. The following C++ classes replace their QDeclarative* equivalents in Qt Quick 1:

  • QQuickView
  • QQuickCanvas
  • QQuickItem
  • QQuickPaintedItem

The QtQuick 2.0 QML module is a major update. Below are the additions and changes for the QtQuick 2.0 QML Module:

Visual and Graphic types

  • New Canvas type for drawing. This provides a HTML5 canvas like API along with some additional features.
    • Supports two render targets: Canvas.Image and Canvas.FramebufferObject.
    • Supports background thread rendering.
    • Supports tiled canvas rendering.
    • Supports most of the HTML5 context2d APIs.
  • Image:
    • New horizontalAlignment and verticalAlignment properties.
    • New Image.Pad enum value for fillMode that does not transform the image, unlike the other fillMode enum values.
    • Setting Image sourceSize.width and sourceSize.height now fits the image to the size, maintaining aspect ratio.


  • New SpriteSequence type renders animated sprites and can transition between animations.
  • New Sprite type which represents each animation in a SpriteSequence.
  • New AnimatedSprite type for drawing single sprite animations.


  • Text:
    • With AutoText format, a Text item now automatically switches to StyledText instead of RichText.
    • New onLineLaidOut handler is called for every line during the layout process to give the option of positioning and/or resizing lines as they are laid out.
    • New doLayout() method will trigger the text layout from Javascript.
    • RightElide is now supported where text spans multiple lines.
    • New fontSizeMode property allows text to be fitted to the item size.
    • New minimumPixelSize and minimumPointSize properties can be used to specify a lower bound when auto-fitting.
  • TextEdit:
    • textFormat property now defaults to PlainText instead of AutoText.
  • TextInput:
    • New wrapMode property.
    • New verticalAlignment properties.
    • positionAt() function now takes a y parameter.

User Input

  • New MultiPointTouchArea type.
    • Processes multi-point touches and provides information on touch points including position, pressure and velocity.
  • MouseArea:
    • Wheel events are now propagated.
    • The clicked, doubleClicked and pressAndHold events are now propagated differently to pressed. These will now be propagated to the highest-stacking-order enabled MouseArea which has a handler for them. You can still ignore these events in the handler to let them pass through. This behavior is triggered with the new property propagateComposedEvents.
    • New propagateComposedEvents property sets whether composed events are propagated to other mouse areas.

Specialised Containers

  • Flickable:
    • New rebound property allows a transition to be specified for a flickable’s bounce back animation.
    • New topMargin, bottomMargin, leftMargin, rightMargin allow extra margin space to be specified for a flickable. This can be used, for example, to implement the pull-to-refresh functionality for a list.
    • New xOrigin and yOrigin properties provide the top left position of the content item.
    • New dragging, draggingHorizontally and draggingVertically properties provide information on whether a flickable is currently being dragged.

Positioners (Row, Column, Grid, Flow types):

  • The “add” and “move” transitions can now access a ViewTransition attached property (see the ViewTransition documentation for examples) and can now animate arbitrary item properties (instead of being restricted to animating an item’s position).
  • New Positioner.index, Positioner.isFirstItem and Positioner.isLastItem attached properties for items in positioners.
  • Grid:
    • New rowSpacing and columnSpacing properties.
    • All spacing properties on positioners now use real numbers instead of integers.

Models and Views

  • ListView and GridView:
    • Transitions can now be specified to animate the adding, removing and moving of items in a view. See the documentation for ViewTransition and ListView.add, ListView.addDisplaced, GridView.add, GridView.addDisplaced etc. for details.
    • New verticalLayoutDirection property enables items to be laid out from bottom-to-top using the BottomToTop enum value.
    • The cacheBuffer property now has a non-zero default and delegates in the cacheBuffer are created asynchronously.
    • New headerItem and footerItem properties provide access to the instantiated header and footer items.
    • RightToLeft layout now also reverses the preferredHighlightBegin and preferredHighlightEnd.
  • ListView only:
    • New section.labelPositioning property can fix the current section label to the start of the view, and the next section label to the end of the view, so that labels do not scroll while section items are still in view.
  • PathView:
    • New currentItem property.
    • New maximumFlickVelocity property.

Particles System Support

The new QtQuick.Particles 2.0 module provides support for the composition of a variety of 2D particle systems. See the QtQuick.Particles documentation for comprehensive details.

Utility types

  • New PathArc, PathCurve and PathSvg types:
    • PathArc and PathCurve support the construction of arcs and catmull-rom curves, respectively. PathSvg supports the construction of a path from a SVG string.
  • Loader:
    • New asynchronous property allows components to be instantiated with lower chance of blocking.
      • If source is used with asynchonous: true the component will be compiled in a background thread.
    • New active property delays instantiation of a Loader object’s item.
    • New setSource(JSObject) method for specifying initial property values for the loaded item, similar to Component.createObject().
    • sourceChanged signal is now only emitted when the source is changed and the sourceComponentChanged signal is now only emitted when the sourceComponent is changed. (Previously Loader emitted both signals when only one of the properties had changed.)
  • Binding:
    • This type can now be used as a value source, and will also restore any previously set binding when its when clause becomes false.

Qt Multimedia

Qt Multimedia is a new essential module replacing the QtMultimedia library and Qt MultimediaKit mobility API in Qt 4.8. It features full support for Audio and Video playback and recording. Support for web cameras is integrated.

Qt Multimedia uses the system’s native multimedia engine as a backend, and does not come with it’s own audio or video codecs. Thus the supported list of codecs is equivalent to the ones supported by the underlying OS.

Qt Multimedia uses DirectShow and WMF on Windows, AVFoundation on Mac and gstreamer on Linux. An implementation for Blackberry 10 is also available.


Qt 3D

Qt 3D is a new Qt 5.0 module, although it has existed as a labs project for a number of years, and has also contributed a lot of code to Qt. For example the classes QMatrix4×4, QGLShaderProgram and QVector3D all come from Qt 3D originally. Qt3D runs on top of QML2 and the Qt OpenGL support.

Qt 3D contains two libraries:

  • Qt 3D Quick – Use QML to code 3D content, accelerated by OpenGL
  • Qt 3D – C++ classes which support Qt 3D Quick, and can also be used directly

Current Feature Set for Qt 3D includes:

  • GL renderer including basic lighting
  • 3D Scene management
  • Loading of 3D assets such as .obj and .3ds files
  • Stock shapes and geometry
  • Geometry loading and management
  • Textures and materials
  • Simple geometric animations
  • Cameras and Views

The above features are all exposed by the QML API. Additionally in QML you can:

  • Create inline or from source file shaders which automatically bind to QML properties
  • Create 3D scenes by using QML scoping
  • Mix declarative code such as animation easing curves and states with 3D

Qt Location

Qt Location is a new Qt 5.0 module although it has existed as part of Qt Mobility for a number of years. Compared to the feature set provided by the Qt Mobility version of the Location API the following changes have been made:

  • Maps are now part of the QML2 scenegraph, and rendered using hardware- accelerated OpenGL
  • Arbitrary QML2 items on the map are supported using MapQuickItem
  • Model-view support for creating map objects from a QML model
  • Built-in support for pinch-to-zoom gestures, flicking and “kinetic” panning
  • Vast performance improvements over Mobility 1.2, especially for large map polylines and objects in general
  • Full QML API now available for routing and geocoding — compatible with standard QML model-view design
  • Service provider feature detection without having to open all the available plugins
  • Unified “Plugin” QML element used by routing/geocoding/maps etc with easy-to-set PluginParameters
  • Landmarks API is replaced by the Places API:
    • Both C++ and QML APIs have been reworked to be simpler to use.
    • The new API supports viewing of richer content such as reviews, images and editorials
    • The new API also supports locale handling, sponsored search results and supplier attribution
    • There is a REST Plugin which allows access to a Places REST service
    • There is a JsonDb Plugin which allows saving of locally stored favorites