- Qt 5.3
- What's New in Qt 5.0
- Qt 5.3.2 Reference Documentation

# What's New in Qt 5.0

## Qt Core Changes

### QStandardPaths

QStandardPaths is a more powerful version of QDesktopServices that was present in Qt 4. Modeled after KStandardDirs from KDE 4, it contains additional features such as searching for all occurrences of a given file in the storage locations.

### Compile-time Checks for Signal-slot Connections

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

This 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

QRegularExpression is introduced to provide better support for regular expressions compatible with Perl. This class is more powerful and faster than QRegExp, and supports more features such as lazy and possessive quantifiers, lookbehinds, named capturing groups, and iteration of matches.

## Qt GUI Changes

### New 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 Qt Widgets module and by l{Qt Quick} 2.

### OpenGL Classes

Most of the useful l{Qt OpenGL} classes have been polished and moved into Qt GUI. A few important ones are, QOpenGLFramebufferObject, QOpenGLShaderProgram, QOpenGLFunctions, and so on. For the complete list, refer to Qt GUI C++ Classes.

This change introduces QOpenGLContext as a replacement for QGLContext. This replacement class is more generic and decoupled from QWindow, making it to support more use cases such as using the same context for multiple surfaces.

### QOpenGLPaintDevice

Instead of having QWindow and QOpenGLFramebufferObject be subclasses of QPaintDevice, you can now use QOpenGLPaintDevice. This new alternative can be created on the stack, makes it easier and flexible to render into the currently bound context using QPainter.

## Qt Network Changes

### QDnsLookup

It is now possible to lookup DNS records using the new QDnsLookup API. This does not replace QHostInfo, which is still the API to be used 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.

Note: This new class replaces the Q3Dns API, which is removed in Qt 5.

### Better Support for IPv6 and Dual-mode Networks

Most applications using host names and network layer transparent protocols, will now gain IPv6 support transparently. This means, QTcpServer and QUdpSocket bound to QHostAddress::Any can now receive both IPv4 and IPv6 connections, although, QHostAddress::AnyIPv4 and QHostAddress::AnyIPv6 can be used to bind to only one protocol.

Outgoing http connections using QNetworkAccessManager will now attempt both IPv4 and IPv6 connections in parallel, and use the one that succeeds first.

### Binding TCP Sockets

QTcpSocket can be bound to an IP address before connecting, which is useful for limiting connection to a specific interface in a multi-homed environment.

### SSL Certificates

SSL certificate extensions can now be accessed to enable further development of SSL support in Qt.

Developers can also verify an SSL certificate chain programatically now.

### Workarounds for Buggy SSL Servers

The QSsl::SslOption enum now allows a QSslSocket-based code to access legacy systems by enabling bug workarounds.

Note: This change is also back-ported 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 the qsslkey example

## Qt QML Changes

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

### QML Engine

- V8 JavaScript engine
- Various parser and compiler optimizations have been implemented along with the new bindings optimizer.
- Loading/compilation can now be performed in a separate thread. This can be enabled by loading a loader object asynchronously through its source property, or by passing the Component.Asynchronous parameter to Qt.createComponent().
- New QQmlEngine::trimComponentCache() function safely discards unused data in the engine’s component cache to free memory.

### Type System

- New var property type can hold JavaScript references.
- QML properties of type var and variant can now hold pixmaps. See Scarce Resources in JavaScript for more information.
- Value type improvements:
  - QColor is now a value type. The red, green, blue and alpha channels of a “color” property can now be accessed using “r”, “g”, “b” and “a” properties.
  - Improved support for QVector4D, now constructible in QML using 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 from JavaScript.

### Other

- JavaScript (.js) files can now import QML modules and other JavaScript files using the “import” statement.
- QQmlExpression can now be constructed directly (and more efficiently) from a QQmlScriptString.
- The component returned by Qt.createComponent() is no longer the owned by the engine. Be sure to hold a reference,or provide a parent.

## Qt Quick Changes

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-based application development.

The module replaces the QDeclarative* equivalents in QtQuick 1 with the following:

- QQuickView
- QQuickCanvas
- QQuickItem
- QQuickPaintedItem

See Qt Quick C++ Classes for the complete list.

The QtQuick 2.0 QML module is a major update, and the following sections outline the features that come with it:

### New Graphics Architecture

- Qt Quick 2.0 uses a dedicated OpenGL (ES) 2.0 based Qt Quick Scene Graph scene graph for all its rendering.

### Visual and Graphic Types

- New Canvas type for drawing, provides a HTML5 canvas-like API along with the following additional features:
  - Two render targets: `Canvas::Image`{Canvas.Image} and `Canvas::FrameBufferObject`{Canvas.FramebufferObject}.
  - Background thread rendering.
  - Tiled canvas rendering.
  - Support for most of the HTML5 context2d APIs.
- Image type now has:
  - New horizontal and vertical alignment properties, horizontalAlignment and verticalAlignment.
  - Image.Pad enum value for `fillMode` property does not transform the image unlike the other `fillMode` enum values.
  - sourceSize.width and sourceSize.height now fits the image to size maintaining the aspect ratio.

### Animations

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

### Text

- Text:
  - AutoText format now switches to `StyledText` instead of `RichText`.
  - lineLaidOut signal is emitted for every line during the layout process to give the option of positioning and/or resizing text as they are laid out.
  - doLayout() method can now trigger the text layout from JavaScript.
  - ElideRight to support text that spans multiple lines.
  - fontSizeMode property now supports wrapping the text to the item size.
  - minimumPixelSize and minimumPointSize properties can be used to specify a lower bound when auto-fitting.
- `TextEdit::textFormat`{TextEdit.textFormat} property now defaults to `PlainText` instead of `AutoText`.
- TextInput now has `wrapMode` and verticalAlignment properties.
- `TextInput.positionAt()` now takes `y` value.

### User Input

- New MultiPointTouchArea type can process multi-point touches and provide information about the touch points including position, pressure and velocity.
- MouseArea type now:
  - Propagates wheel events.
  - Propagates `clicked`, `doubleClicked` and `pressAndHold` events differently to `pressed`. These events are propagated to the handler of the topmost MouseArea in the stack-order.
  - Can ignore the propagated events using the `propagateComposedEvents`. Such ignored events are propagated to the next MouseArea handler in the stack-order.

### Specialized Containers

- Flickable type now has:
  - a new `rebound` property that enables you to specify the transition type for the bounce back animation.
  - New `topMargin`, `bottomMargin`, `leftMargin`, and `rightMargin` properties allow extra margin space to be specified. This is useful 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 that provide information when the flickable area is dragged.

### Positioners

The following features are related to Row, Column, Grid, and Flow types:

- The “add” and “move” transitions can now access the ViewTransition attached property, and also 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 within a positioner.
- The Grid type has 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 be specified to animate the adding, removing and moving of items in a view. For details, see ViewTransition, ListView.add, ListView.addDisplaced, GridView.add, and GridView.addDisplaced.
  - 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's 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 has two new properties, `curretnItem` and `maximumFlickVelocity`.

### Particles System Support

The new QtQuick.Particles 2.0 module provides support for the composition of a variety of 2D particle systems. See `Using the Qt Quick Particle System` for more 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 an SVG string.
- Loader:
  - New `asynchronous` property allows components to be instantiated with a lower chance of blocking. With the `asynchronous` property set to `true`, the component is compiled in a background thread.
  - New `active` property delays instantiation of a Loader object’s item.
  - New `setSource(JSObject)` method to specify initial property values for the loaded item, similar to `Component::createObject` {Component.createObject()}.
  - `sourceChanged` signal is now only emitted when the source changes and the `sourceComponentChanged` signal is now emitted when the `sourceComponent` is changed. Ealier, these signals were emitted by the Loader only when one of the two properties had changed.
  - Loader type can now be used as a value source, and it can restore any previously set binding if its "when" clause becomes `false`.

## Qt Multimedia Changes

Qt Multimedia is an 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 its own audio or video codecs. Thus the supported list of codecs is equivalent to the ones supported by the underlying OS.

It uses DirectShow and WMF on Windows, AVFoundation on Mac and gstreamer on Linux.

## New Classes and Functions

The section provides a comprehensive list of all new classes and functions introduced in Qt 5.

- New Classes
- New Member Functions
- New Global Functions
- New Macros
- New Enum Types
- New Typedefs
- New Properties
- New QML Types

### New Classes

A
  QAbstractNativeEventFilter

B
  QBackingStore

C
  QCameraFeedbackControl
  const_iterator (QJsonObject)

D
  QDnsLookup

E
  QEnterEvent
  QEventLoopLocker
  QException
  QExposeEvent

F
  QFileDevice

G
  QGuiApplication

I
  QInputMethodQueryEvent
  iterator (QJsonObject)

J
  QJSEngine
  QJsonArray
  QJsonDocument
  QJsonObject
  QJsonParseError
  QJsonValue
  QJSValue

M
  QMessageLogContext
  QMessageLogger
  QMimeDatabase
  QMimeType

O
  QOpenGLBuffer
  QOpenGLContext
  QOpenGLContextGroup
  QOpenGLFramebufferObject
  QOpenGLFramebufferObjectFormat
  QOpenGLFunctions
  QOpenGLPaintDevice
  QOpenGLShader
  QOpenGLShaderProgram

Q
  QQmlComponent
  QQmlEngine
  QQmlError
  QQmlExpression
  QQmlExtensionPlugin
  QQmlListProperty
  QQmlListReference
  QQmlNetworkAccessManagerFactory
  QQmlParserStatus
  QQmlProperty
  QQuickImageProvider
  QQuickTextureFactory
  QQuickView
  QQuickWindow

R
  QRegularExpression
  QRegularExpressionMatch
  QRegularExpressionMatchIterator

S
  QScreen
  QScroller
  QSensorGesturePluginInterface
  QSslCertificateExtension
  QStandardPaths
  QStyleHints
  QSurface
  QSurfaceFormat

T
  QTouchDevice

U
  QUnhandledException
  QUrlQuery

W
  QWindow
  QWinEventNotifier

### New Member Functions

Class QNetworkProxy:

| hasRawHeader(const QByteArray & headerName) const
| header(QNetworkRequest::KnownHeaders header) const
| rawHeader(const QByteArray & headerName) const
| rawHeaderList() const
| setHeader(QNetworkRequest::KnownHeaders header, const QVariant & value)
| setRawHeader(const QByteArray & headerName, const QByteArray & headerValue)
| swap(QNetworkProxy & other)

Class QNetworkAddressEntry:

| swap(QNetworkAddressEntry & other)

Class QNetworkProxyQuery:

| swap(QNetworkProxyQuery & other)

Class QNetworkInterface:

| swap(QNetworkInterface & other)

Class QNetworkConfiguration:

| swap(QNetworkConfiguration & other)

Class QNetworkSession:

| usagePoliciesChanged(QFlags<QNetworkSession::UsagePolicy> usagePolicies)

Class QNetworkRequest:

| swap(QNetworkRequest & other)

Class QNetworkReply:

virtual | ignoreSslErrorsImplementation(const QList<QSslError> & errors)
virtual | setSslConfigurationImplementation(const QSslConfiguration & configuration)
virtual | sslConfigurationImplementation(QSslConfiguration & configuration) const

Class QCameraFeedbackControl:

virtual | isEventFeedbackEnabled(EventType event) const = 0
virtual | isEventFeedbackLocked(EventType event) const = 0
virtual | resetEventFeedback(EventType event) = 0
virtual | setEventFeedbackEnabled(EventType event, bool enabled) = 0
virtual | setEventFeedbackSound(EventType event, const QString & filePath) = 0

Class QLocalServer:

| listen(qintptr socketDescriptor)
| socketOptions() const

Class QSslCertificate:

| extensions() const
| issuerInfoAttributes() const
| subjectInfoAttributes() const
| swap(QSslCertificate & other)
| toText() const
| verify(QList<QSslCertificate> certificateChain, const QString & hostName)

Class QSslSocket:

virtual | resume()
| sslLibraryVersionNumber()
| sslLibraryVersionString()

Class QSslKey:

| swap(QSslKey & other)

Class QSslError:

| swap(QSslError & other)

Class QSslConfiguration:

| swap(QSslConfiguration & other)

Class QSslCipher:

| swap(QSslCipher & other)

Class QDBusUnixFileDescriptor:

| swap(QDBusUnixFileDescriptor & other)

Class QDBusPendingCall:

| swap(QDBusPendingCall & other)

Class QPrinterInfo:

| description() const
| location() const
| makeAndModel() const
| printerInfo(const QString & printerName)

Class QProcessEnvironment:

| swap(QProcessEnvironment & other)

Class QCryptographicHash:

| addData(QIODevice * device)

Class QEasingCurve:

| swap(QEasingCurve & other)
| toCubicSpline() const

Class QSharedPointer:

| reset()
| reset(T * t)
| reset(T * t, Deleter deleter)

Class QNetworkCookieJar:

virtual | deleteCookie(const QNetworkCookie & cookie)
virtual | insertCookie(const QNetworkCookie & cookie)
virtual | updateCookie(const QNetworkCookie & cookie)
virtual | validateCookie(const QNetworkCookie & cookie, const QUrl & url) const

Class QNetworkCookie:

| normalize(const QUrl & url)
| operator==(const QNetworkCookie & other) const
| swap(QNetworkCookie & other)

Class QNetworkAccessManager:

| clearAccessCache()

Class QHttpPart:

| swap(QHttpPart & other)

Class QNetworkCacheMetaData:

| swap(QNetworkCacheMetaData & other)

Class TouchPoint:

| rawScreenPositions() const

Class QGuiApplication:

| isSavingSession() const

Class QGlyphRun:

| boundingRect() const
| flags() const
| isEmpty() const
| isRightToLeft() const
| setBoundingRect(const QRectF & boundingRect)
| setFlag(GlyphRunFlag flag, bool enabled)
| setFlags(QFlags<QGlyphRun::GlyphRunFlag> flags)
| setRightToLeft(bool rightToLeft)
| swap(QGlyphRun & other)

Class QRawFont:

| boundingRect(quint32 glyphIndex) const
| swap(QRawFont & other)

Class QStaticText:

| swap(QStaticText & other)

### New Global Functions

| operator!=(const QMetaMethod & m1, const QMetaMethod & m2)
| operator+(const QPointF & point)
| operator+(const QPoint & point)
| operator<<(QDebug debug, const QNetworkProxy & proxy)
| operator==(const QMetaMethod & m1, const QMetaMethod & m2)
| qHash(ushort key, uint seed)
| qHash(ulong key, uint seed)
| qHash(uint key, uint seed)
| qHash(uchar key, uint seed)
| qHash(signed char key, uint seed)
| qHash(short key, uint seed)
| qHash(quint64 key, uint seed)
| qHash(qint64 key, uint seed)
| qHash(long key, uint seed)
| qHash(int key, uint seed)
| qHash(const T * key, uint seed)
| qHash(const QPair<T1, T2> & key, uint seed)
| qHash(char key, uint seed)
| qHash(QChar key, uint seed)
| qHash(const QStringRef & key, uint seed)
| qHash(const QString & key, uint seed)
| qHash(const QByteArray & key, uint seed)
| qHash(const QBitArray & key, uint seed)
| qHash(QLatin1String key, uint seed)
| qHash(const QTime & key, uint seed)
| qHash(const QDateTime & key, uint seed)
| qHash(const QDate & key, uint seed)
| qHash(const QUuid & uuid, uint seed)
| qHash(const QPersistentModelIndex & index, uint seed)
| qHash(const QUrl & url, uint seed)
| qInstallMessageHandler(QtMessageHandler handler)
| qRegisterStaticPluginFunction(QStaticPlugin plugin)
| qSetMessagePattern(const QString & pattern)

### New Macros

| QFINDTESTDATA( filename)
| QTEST_GUILESS_MAIN( TestClass)
| QTRY_COMPARE( actual, expected)
| QTRY_COMPARE_WITH_TIMEOUT( actual, expected, timeout)
| QTRY_VERIFY( condition)
| QTRY_VERIFY_WITH_TIMEOUT( condition, timeout)
| Q_ASSUME(bool expr)
| Q_DECLARE_OPAQUE_POINTER( PointerType)
| Q_DECL_FINAL
| Q_DECL_NOEXCEPT
| Q_DECL_NOEXCEPT_EXPR( x)
| Q_DECL_NOTHROW
| Q_DECL_OVERRIDE
| Q_PLUGIN_METADATA(...)
| Q_SET_OBJECT_NAME( Object)
| Q_UNREACHABLE()

### New Enum Types

enum | GlyphRunFlag { Overline, Underline, StrikeOut, RightToLeft, SplitLigature }
enum | SocketOption { NoOptions, UserAccessOption, GroupAccessOption, OtherAccessOption, WorldAccessOption }
enum | UsagePolicy { NoPolicy, NoBackgroundTrafficPolicy }

### New Typedefs

typedef | QImageCleanupFunction
typedef | QtMessageHandler

### New Properties

- applicationDisplayName : const
- socketOptions : const

### New QML Types

A
  AttenuationModelInverse
  AttenuationModelLinear
  AudioCategory
  AudioEngine
  AudioListener
  AudioSample

C
  Canvas
  CanvasGradient
  Context2D

G
  GridMesh

P
  ParentAnimation
  PathAnimation
  PlayVariation

S
  ShaderEffectSource
  Sound
  SoundInstance

T
  TextMetrics

## Additions to Other Qt 5 Releases

- What's New in Qt 5.3
- What's New in Qt 5.2
- What's New in Qt 5.1