New Features in Qt 5.0: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=Qt 5 Features=
[[Category:Developing_with_Qt::Qt 5]]<br />h1. Qt 5 Features


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


'''<span class="caps">FIXME</span> <span class="caps">PLEASE</span> <span class="caps">ADD</span> <span class="caps">THE</span> <span class="caps">INFORMATION</span> <span class="caps">RELATIVE</span> TO <span class="caps">YOUR</span> <span class="caps">OWN</span> <span class="caps">COMPONENT</span>'''
[toc align_right=&quot;yes&amp;quot;]


==<span class="caps">FIXME</span> To be sorted out==
'''FIXME PLEASE ADD THE INFORMATION RELATIVE TO YOUR OWN COMPONENT'''


Also we have: QTemporaryDir, Added a<br /> QStringLiteral macro, and C++11 support, better logging support through qDebug
== FIXME To be sorted out ==


Some new add-on modules: jsondb, qgraphicseffects
Also we have: QTemporaryDir, Added a<br />QStringLiteral macro, and C+''11 support, better logging support through qDebug
<br />Some new add-on modules: jsondb, qgraphicseffects
<br />h2. Qt Essentials
<br />h3. Qt Core
<br />h4. QStandardPaths
<br />QStandardPaths is a more powerful version of [[Doc:QDesktopServices]] that was present in Qt 4. Modelled after &lt;a href=&quot;http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKStandardDirs.html&amp;quot;&gt;KStandardDirs&amp;lt;/a&amp;gt; from KDE 4, it contains more features, like searching for all occurrences of a given file in the storage locations.
<br />h4. MimeTypes
<br />QMimeDatabase offers the functionality of determining the mimetype for a given file<br />or memory buffer, from extension and/or from the contents.
<br />The MIME type database is provided by the freedesktop.org shared-mime-info<br />project. If the MIME type database cannot be found on the system, as is the case<br />on most Windows and Mac OS X systems, Qt will use its own copy of it.
<br />h4. JSON support
<br />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.
<br />h4. Compile-time checking for signal-slot connections
<br />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.
<br />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.
<br />h4. Perl-Compatible Regular Expressions
<br />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.
<br />h3. Qt GUI
<br />h4. New enabler classes for windowing and rendering
<br />A new set of enabler classes have been added, most importantly QWindow, QScreen,<br />QSurfaceFormat, and QOpenGLContext. These are now used as backends for the<br />QtWidgets module, and directly by QtQuick 2.
<br />h4. A set OpenGL classes mostly equivalent to the ones in Qt 4's QtOpenGL module
<br />Most of the useful Qt OpenGL classes have been polished and moved into<br />Qt GUI. See QOpenGLFramebufferObject, QOpenGLShaderProgram,<br />QOpenGLFunctions, etc.
<br />The replacement for QGLContext, QOpenGLContext, is more generic and decoupled<br />from QWindow, making it support more use cases, such as using the same context<br />for multiple surfaces.
<br />h4. QOpenGLPaintDevice
<br />Instead of having QWindow and QOpenGLFramebufferObject be subclasses of<br />QPaintDevice, there's now QOpenGLPaintDevice that can be created on the stack,<br />making the use of QPainter to render into the currently bound context easier and<br />more flexible.
<br />h4. Support for additional mouse buttons, often present on &quot;gamer&amp;quot; mouse devices
<br />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.
<br />h3. Qt Network
<br />h4. QDnsLookup
<br />It is now possible to lookup DNS records using the new QDnsLookup API.<br />This does not replace QHostInfo, which is still the API to use for resolving a host name to an IP address.<br />QDnsLookup is mainly used for other types of DNS record, such as SRV, TXT and MX<br />This replaces the deprecated Q3Dns API.
<br />h4. Improved support for IPv6 and dual mode networks
<br />Most applications using host names and network layer transparent protocols will gain IPv6 support transparently.<br />QTcpServer &amp; QUdpSocket bound to QHostAddress::Any will be able to receive both IPv4 and IPv6 connections.<br />QHostAddress::AnyIPv4 and QHostAddress::AnyIPv6 can be used to bind to only one protocol.<br />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.
<br />h4. Binding of TCP sockets
<br />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.
<br />h4. Removal of QFtp and QHttp APIs
<br />The QHttp API has been removed, due to duplicated functionality.<br />QNetworkAccessManager can be used instead for nearly all cases.<br />The QFtp API has been removed as a public API, due to implementation quality.<br />QNetworkAccessManager can be used to get/put an ftp url.<br />These APIs will be provided in a standalone form to ease migration.
<br />h4. SSL Certificate Extensions
<br />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.
<br />h4. SSL Certificate Verification
<br />Support for verifying an SSL certificate chain programatically, not just when connecting to an SSL server was added.
<br />h4. Workarounds for Buggy SSL Servers
<br />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.
<br />h4. Support for opaque Private Keys
<br />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


==Qt Essentials==
<br />h3. Qt QML
<br />This is a new module in Qt 5 that provides the QML engine and backend infrastructure.
<br />h4. QML Engine
<br />* JavaScript engine has changed to V8.<br />* Various parser and compiler optimizations have been implemented, as well as a new bindings optimizer.<br />* 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().<br />* New QQmlEngine::trimComponentCache() which safely discards unused data in the engine's component cache to free memory.
<br />h4. Type System
<br />* New &quot;var&amp;quot; property type. This is a general-purpose property type which obsoletes the &quot;variant&amp;quot; type. Properties of the &quot;var&amp;quot; type may hold JavaScript references. See &quot;QML Basic Types&amp;quot; for more information.<br />* QML properties of type &quot;var&amp;quot; and &quot;variant&amp;quot; can now hold pixmaps. See &quot;Scarce Resources in JavaScript&amp;quot; for more information.<br />* ValueType improvements:<br />'''''' QColor is now a value type. The red, green, blue and alpha channels of a &quot;color&amp;quot; property can be accessed via &quot;r&amp;quot;, &quot;g&amp;quot;, &quot;b&amp;quot; and &quot;a&amp;quot; properties<br />'''''' Improved support for QVector4D, now constructible in QML via Qt.vector4d()<br />* Support for certain sequence types (QList&amp;lt;int&amp;gt;, QList&amp;lt;qreal&amp;gt;, QList&amp;lt;bool&amp;gt;, QList&amp;lt;QUrl&amp;gt;, QList&amp;lt;QString&amp;gt; and QStringList) has been improved. QObjects can define Q_PROPERTYs of these types which can be accessed transparently from JavaScript.
<br />h4. Modules and Imports
<br />* Arbitrary functionality may be provided in a namespace through a Module API. See &quot;qmlRegisterModuleApi()&quot; for more information.<br />* JavaScript (.js) files may now import QML modules and other JavaScript files using the &quot;.import&amp;quot; syntax.
<br />h4. Other
<br />* QQmlExpression can now be constructed directly (and more efficiently) from a QQmlScriptString.<br />* The component returned by Qt.createComponent() is no longer parented to the engine. Be sure to hold a reference, or provide a parent.


===Qt Core===
<br />h3. Qt Quick
 
<br />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.
====QStandardPaths====
<br />Qt Quick 2 is based on an OpenGL scenegraph. The following C''+ classes replace their QDeclarative* equivalents in Qt Quick 1:
 
QStandardPaths is a more powerful version of [[doc/QDesktopServices|QDesktopServices]] that was present in Qt 4. Modelled after &lt;a href=“[http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKStandardDirs.html”>KStandardDirs</a> http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKStandardDirs.html”&gt;KStandardDirs&lt;/a&gt;] from <span class="caps">KDE</span> 4, it contains more features, like searching for all occurrences of a given file in the storage locations.
 
====MimeTypes====
 
QMimeDatabase offers the functionality of determining the mimetype for a given file<br /> or memory buffer, from extension and/or from the contents.
 
The <span class="caps">MIME</span> type database is provided by the freedesktop.org shared-mime-info<br /> project. If the <span class="caps">MIME</span> type database cannot be found on the system, as is the case<br /> on most Windows and Mac OS X systems, Qt will use its own copy of it.
 
====<span class="caps">JSON</span> support====
 
QtCore now includes a set of classes for parsing and generating <span class="caps">JSON</span> documents. Those classes allow you to convert between in memory binary representation of <span class="caps">JSON</span> to standard textual <span class="caps">JSON</span> format. The goal is to make common operations on <span class="caps">JSON</span> 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.
 
===Qt <span class="caps">GUI</span>===
 
====New enabler classes for windowing and rendering====
 
A new set of enabler classes have been added, most importantly QWindow, QScreen,<br /> QSurfaceFormat, and QOpenGLContext. These are now used as backends for the<br /> 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<br /> Qt <span class="caps">GUI</span>. See QOpenGLFramebufferObject, QOpenGLShaderProgram,<br /> QOpenGLFunctions, etc.
 
The replacement for <span class="caps">QGLC</span>ontext, QOpenGLContext, is more generic and decoupled<br /> from QWindow, making it support more use cases, such as using the same context<br /> for multiple surfaces.
 
====QOpenGLPaintDevice====
 
Instead of having QWindow and QOpenGLFramebufferObject be subclasses of<br /> QPaintDevice, there’s now QOpenGLPaintDevice that can be created on the stack,<br /> making the use of QPainter to render into the currently bound context easier and<br /> 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 <span class="caps">XCB</span>, <span class="caps">XLIB</span>, 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===
 
====QDnsLookup====
 
It is now possible to lookup <span class="caps">DNS</span> records using the new QDnsLookup <span class="caps">API</span>.<br /> This does not replace QHostInfo, which is still the <span class="caps">API</span> to use for resolving a host name to an IP address.<br /> QDnsLookup is mainly used for other types of <span class="caps">DNS</span> record, such as <span class="caps">SRV</span>, <span class="caps">TXT</span> and MX<br /> This replaces the deprecated Q3Dns <span class="caps">API</span>.
 
====Improved support for IPv6 and dual mode networks====
 
Most applications using host names and network layer transparent protocols will gain IPv6 support transparently.<br /> QTcpServer &amp; QUdpSocket bound to QHostAddress::Any will be able to receive both IPv4 and IPv6 connections.<br /> QHostAddress::AnyIPv4 and QHostAddress::AnyIPv6 can be used to bind to only one protocol.<br /> 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 <span class="caps">TCP</span> 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 <span class="caps">API</span>s====
 
The QHttp <span class="caps">API</span> has been removed, due to duplicated functionality.<br /> QNetworkAccessManager can be used instead for nearly all cases.<br /> The QFtp <span class="caps">API</span> has been removed as a public <span class="caps">API</span>, due to implementation quality.<br /> QNetworkAccessManager can be used to get/put an ftp url.<br /> These <span class="caps">API</span>s will be provided in a standalone form to ease migration.
 
====<span class="caps">SSL</span> Certificate Extensions====
 
Support for accessing <span class="caps">SSL</span> 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 <span class="caps">SSL</span> support.
 
====<span class="caps">SSL</span> Certificate Verification====
 
Support for verifying an <span class="caps">SSL</span> certificate chain programatically, not just when connecting to an <span class="caps">SSL</span> server was added.
 
====Workarounds for Buggy <span class="caps">SSL</span> Servers====
 
Support for working around buggy <span class="caps">SSL</span> 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 <span class="caps">PKCS</span>#11 dongles, as illustrated by http://git.iksaif.net/?p=qsslkey-p11.git;a=tree
 
===Qt <span class="caps">QML</span>===
 
This is a new module in Qt 5 that provides the <span class="caps">QML</span> engine and backend infrastructure.
 
====<span class="caps">QML</span> 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 “<span class="caps">QML</span> Basic Types” for more information.
* <span class="caps">QML</span> 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 <span class="caps">QML</span> via Qt.vector4d()
* Support for certain sequence types (QList&lt;int&gt;, QList&lt;qreal&gt;, QList&lt;bool&gt;, QList&lt;QUrl&gt;, QList&lt;QString&gt; 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 <span class="caps">API</span>. See “qmlRegisterModuleApi()” for more information.
* JavaScript (.js) files may now import <span class="caps">QML</span> modules and other JavaScript files using the “.import” syntax.
 
====Other====
 
* 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 <span class="caps">QML</span> module for <span class="caps">QML</span> application development.
 
Qt Quick 2 is based on an OpenGL scenegraph. The following C++ classes replace their QDeclarative* equivalents in Qt Quick 1:


* QQuickView
* QQuickView
Line 134: Line 73:
* QQuickPaintedItem
* QQuickPaintedItem


The QtQuick 2.0 <span class="caps">QML</span> module is a major update. Below are the additions and changes for the QtQuick 2.0 <span class="caps">QML</span> Module:
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====
==== Visual and Graphic types ====


* New Canvas type for drawing. This provides a HTML5 canvas like <span class="caps">API</span> along with some additional features.
* 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 two render targets: Canvas.Image and Canvas.FramebufferObject.
** Supports background thread rendering.
** Supports background thread rendering.
** Supports tiled canvas rendering.
** Supports tiled canvas rendering.
** Supports most of the HTML5 context2d <span class="caps">API</span>s.
** Supports most of the HTML5 context2d APIs.
* Image:
* Image:
** New horizontalAlignment and verticalAlignment properties.
** New horizontalAlignment and verticalAlignment properties.
Line 148: Line 87:
** Setting Image sourceSize.width and sourceSize.height now fits the image to the size, maintaining aspect ratio.
** Setting Image sourceSize.width and sourceSize.height now fits the image to the size, maintaining aspect ratio.


====Animations====
==== Animations ====


* New SpriteSequence type renders animated sprites and can transition between animations.
* New SpriteSequence type renders animated sprites and can transition between animations.
Line 154: Line 93:
* New AnimatedSprite type for drawing single sprite animations.
* New AnimatedSprite type for drawing single sprite animations.


====Text====
==== Text ====


* Text:
* Text:
Line 170: Line 109:
** positionAt() function now takes a y parameter.
** positionAt() function now takes a y parameter.


====User Input====
==== User Input ====


* New MultiPointTouchArea type.
* New MultiPointTouchArea type.
Line 179: Line 118:
** New propagateComposedEvents property sets whether composed events are propagated to other mouse areas.
** New propagateComposedEvents property sets whether composed events are propagated to other mouse areas.


====Specialised Containers====
==== Specialised Containers ====


* Flickable:
* Flickable:
** New rebound property allows a transition to be specified for a flickable’s bounce back animation.
** 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 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 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.
** New dragging, draggingHorizontally and draggingVertically properties provide information on whether a flickable is currently being dragged.


====Positioners (Row, Column, Grid, Flow types):====
==== 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).
* The &quot;add&amp;quot; and &quot;move&amp;quot; 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.
* New Positioner.index, Positioner.isFirstItem and Positioner.isLastItem attached properties for items in positioners.
* Grid:
* Grid:
Line 195: Line 134:
** All spacing properties on positioners now use real numbers instead of integers.
** All spacing properties on positioners now use real numbers instead of integers.


====Models and Views====
==== Models and Views ====


* ListView and GridView:
* ListView and GridView:
Line 209: Line 148:
** New maximumFlickVelocity property.
** New maximumFlickVelocity property.


====Particles System Support====
==== 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.
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====
==== Utility types ====


* New PathArc, PathCurve and PathSvg 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 <span class="caps">SVG</span> string.
** 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:
* Loader:
** New asynchronous property allows components to be instantiated with lower chance of blocking.
** 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.
*** 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 active property delays instantiation of a Loader object's item.
** New setSource(<span class="caps">JSO</span>bject) method for specifying initial property values for the loaded item, similar to Component.createObject().
** 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.)
** 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:
* 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.
** 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 ===
 
Qt Multimedia is a new essential module replacing the QtMultimedia library and Qt MultimediaKit mobility <span class="caps">API</span> 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 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 DirectShow and <span class="caps">WMF</span> on Windows, <span class="caps">AVF</span>oundation on Mac and gstreamer on Linux. An implementation for Blackberry 10 is also available.
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.


==Add-ons==
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===
== Add-ons ==


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 ===


Qt 3D contains two libraries:
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 QMatrix4x4, QGLShaderProgram and QVector3D all come from Qt 3D originally. Qt3D runs on top of QML2 and the Qt OpenGL support.


* Qt 3D Quick Use <span class="caps">QML</span> to code 3D content, accelerated by OpenGL
Qt 3D contains two libraries:<br />* Qt 3D Quick - Use QML to code 3D content, accelerated by OpenGL<br />* Qt 3D - C++ classes which support Qt 3D Quick, and can also be used directly
* Qt 3D C++ classes which support Qt 3D Quick, and can also be used directly


Current Feature Set for Qt 3D includes:
Current Feature Set for Qt 3D includes:<br />* GL renderer including basic lighting<br />* 3D Scene management<br />* Loading of 3D assets such as .obj and .3ds files<br />* Stock shapes and geometry<br />* Geometry loading and management<br />* Textures and materials<br />* Simple geometric animations<br />* Cameras and Views


* GL renderer including basic lighting
The above features are all exposed by the QML API. Additionally in QML you can:<br />* Create inline or from source file shaders which automatically bind to QML properties<br />* Create 3D scenes by using QML scoping<br />* Mix declarative code such as animation easing curves and states with 3D
* 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 <span class="caps">QML</span> <span class="caps">API</span>. Additionally in <span class="caps">QML</span> you can:
=== Qt Location ===


* Create inline or from source file shaders which automatically bind to <span class="caps">QML</span> properties
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:
* Create 3D scenes by using <span class="caps">QML</span> 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 <span class="caps">API</span> the following changes have been made:


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

Revision as of 14:32, 23 February 2015


h1. Qt 5 Features

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

[toc align_right="yes&quot;]

FIXME PLEASE ADD THE INFORMATION RELATIVE TO YOUR OWN COMPONENT

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
h2. Qt Essentials
h3. Qt Core
h4. QStandardPaths
QStandardPaths is a more powerful version of Doc:QDesktopServices that was present in Qt 4. Modelled after <a href="http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKStandardDirs.html&quot;>KStandardDirs&lt;/a&gt; from KDE 4, it contains more features, like searching for all occurrences of a given file in the storage locations.
h4. MimeTypes
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.
h4. 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.
h4. 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.
h4. 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.
h3. Qt GUI
h4. 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.
h4. 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.
h4. QOpenGLPaintDevice
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.
h4. Support for additional mouse buttons, often present on "gamer&quot; 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.
h3. Qt Network
h4. 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 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.
h4. 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.
h4. 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.
h4. 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.
h4. 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.
h4. SSL Certificate Verification
Support for verifying an SSL certificate chain programatically, not just when connecting to an SSL server was added.
h4. 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.
h4. 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


h3. Qt QML
This is a new module in Qt 5 that provides the QML engine and backend infrastructure.
h4. 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.
h4. Type System
* New "var&quot; property type. This is a general-purpose property type which obsoletes the "variant&quot; type. Properties of the "var&quot; type may hold JavaScript references. See "QML Basic Types&quot; for more information.
* QML properties of type "var&quot; and "variant&quot; can now hold pixmaps. See "Scarce Resources in JavaScript&quot; for more information.
* ValueType improvements:
' QColor is now a value type. The red, green, blue and alpha channels of a "color&quot; property can be accessed via "r&quot;, "g&quot;, "b&quot; and "a&quot; properties
'
Improved support for QVector4D, now constructible in QML via Qt.vector4d()
* Support for certain sequence types (QList&lt;int&gt;, QList&lt;qreal&gt;, QList&lt;bool&gt;, QList&lt;QUrl&gt;, QList&lt;QString&gt; and QStringList) has been improved. QObjects can define Q_PROPERTYs of these types which can be accessed transparently from JavaScript.
h4. 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&quot; syntax.
h4. Other
* 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.


h3. 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.

Animations

  • 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

  • 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&quot; and "move&quot; 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.

Add-ons

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 QMatrix4x4, 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&quot; 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&quot; 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