qt5-intro.qdoc 19.20 KiB
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
****************************************************************************/
/*!
    \page qt5-intro.html
    \title What's New in Qt 5
    \brief Qt 5 features and its benefits
    Qt 5 is the latest version of Qt. It enables developers to develop
    applications with intuitive user interfaces for multiple targets, faster
    than ever before. Qt 5 makes it
    easier to address the latest UI paradigm shifts that touch screens and
    tablets require.
    Developers can be more productive and flexible with the improved support
    for JavaScript and QML in Qt 5, while still having the C++ foundation
    and Qt Widget support. HTML5 developers will feel at home with the Web
    offering that includes Chromium-based Qt WebEngine and Qt WebChannel.
    Qt 5 is highly compatible with Qt 4. It is possible for developers
    of Qt 4 applications to seamlessly move on to Qt 5 with their current
    functionality and gradually develop new things leveraging all the great
    items Qt 5 makes possible.
    Cross-platform portability is made simpler in Qt 5, thanks to the new
    modularized codebase consisting of the
    \l{All Modules}{essential and add-on} modules, and the consolidation
    of the \l{Qt Platform Abstraction}.
    The following sections summarize some of the key features that Qt 5 brings
    to the table.
    \section1 Qt Everywhere on Mobile
    \raw HTML
    <div class="table">
     <table style="background:transparent; border: none">
      <tr><td style="width:50%; border: none; vertical-align: top">
    \endraw
    Qt now comes with production-ready ports for Android, iOS, and WinRT
    (including Windows Phone 8). Extensive work has gone into these platform
    ports, which now extend Qt’s multi-platform promise to cover desktop,
    embedded, and mobile platforms.
    \raw HTML
     <br>
    \endraw
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
With full support for Android, iOS, and WinRT, Qt is a great solution for targeting the mobile markets with a single codebase. It is fast and easy to bring existing desktop or embedded application to mobile, by simply recompiling it. \raw HTML <br> \endraw You can install several demo applications that showcase the power of Qt on these mobile platforms. Here is a small list of such applications: \raw HTML <br> \endraw Demo applications: \list \li \l{Google Play: Introduction to Qt 5}{Introduction to Qt 5} (Google Play) \li \l{Google Play: Qt 5 Everywhere}{Qt 5 Everywhere} (Google Play) \li \l{iTunes: SubAttack}{SubAttack} (App Store) \li \l{iTunes: QtQuicksand}{QtQuicksand} (App Store) \li Quick Forecast on \l{iTunes: Quick Forecast}{App Store}, \l{Google Play: Quick Forecast}{Google Play}, and \l{Windows Store: QuickForeCast}{Windows Store}. \li Qt Hangman on \l{iTunes: Qt Hangman}{App Store} and \l{Google Play: Qt Hangman}{Google Play} \li Flyingbus on \l{iTunes: Flyingbus}{App Store} and \l{Google Play: Flyingbus}{Google Play} \endlist Platform pages: \list \li \l{Qt for Android} \li \l{Qt for iOS} \li \l{Qt for WinRT} \endlist \raw HTML </td><td style="width:50%; vertical-align:top;border: none;"> \endraw \image qt5_everywhere_demo.jpg \caption Qt Everywhere demo on Nexus 7 \raw HTML </td></tr> </table> </div> \endraw \section1 Amazing Graphics Capability and Performance \raw HTML <div class="table"> <table style="background:transparent; border: none"> <tr><td style="width:50%; vertical-align:top;border: none;"> \endraw \image qt5_shadereffect.jpg \caption ShaderEffect on an \l Image \raw HTML </td><td style="width:50%; border: none; vertical-align: top"> \endraw Qt 5 uses an OpenGL-based scene graph to accelerate the graphics of Qt Quick, making it possible to do visually appealing user interfaces with animations, impressive graphical effects and particle systems, even on the constrained hardware environments of mobile and embedded devices. \raw HTML <br> \endraw The benefits of this architectural change in the rendering engine are well demonstrated by the following projects: \list \li \l{Livecoding video effects with Qt5} - The Big Buck Bunny you never saw before. Video effects created using Qt Quick.
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
\li \l{Pimp my video} - Video effects implemented using the shader language with QML. \li \l{QtMediaHub} - The power and convenience of Qt Quick. \li \l{QtonPi} - Good example of Qt 5 running on the low cost hardware, Raspberry PI. \endlist \raw HTML </td></tr> </table> </div> \endraw \section1 Qt Quick in Qt 5 \raw HTML <div class="table"> <table style="background:transparent; border: none;"> <tr><td style="width:50%; border-bottom:0px;"> \endraw \l{Qt Quick} provides the necessary infrastructure to develop QML applications. The latest version (v2.0) of this technology also introduces a set of new C++ classes as a replacement for the QDeclarative* equivalents in Qt Quick 1. New features in Qt Quick include: \list \li \l Canvas for drawing. Canvas provides an API that is similar to the HTML5 Canvas API, along with some additional features. \li \l{ShaderEffect}{Shader Effects} which enable GLSL shader programs to be integrated directly into QML code and applied to items and images. \li \l{Using the Qt Quick Particle System}{Particle Effects} for creating a variety of 2D particle systems. \li \l{Sprite Animations}{Sprites} can be used in animating 2D graphical objects and as a source for particle systems. \li \l{Qt Quick Local Storage QML Types}{Offline storage} is a JavaScript API that conforms with the HTML5 Web Database API for storing data in Qt Quick applications. \li \l{Qt Quick Window QML Types}{Window} provides a top-level window and the Screen type for accessing a screen's resolution and other details. This is useful for desktop applications developed using Qt Quick. \li \l{Qt Quick Scene Graph}{OpenGL-based rendering architecture} for optimal performance. \endlist \raw HTML </td><td style="width:50%; vertical-align:top;border: none;"> \endraw \image qt5_particles.jpg \caption Qt Quick's \l{Qt Quick Particles QML Types}{Particle System} \raw HTML </td></tr><tr><td style="width:50%; vertical-align:top;border: none;"> \endraw The \l {qtgraphicaleffects-index.html}{Qt Graphical Effects} module provides a number of ready-made effects for use in Qt Quick applications, including soft drop shadow, blur, glow and colorize. \raw HTML </td><td style="width:50%; vertical-align:top;border: none;"> \endraw \image qt5_graphicaleffects.jpg \caption Excerpts from the Qt Graphical Effects module \raw HTML </td></tr> </table> </div> \endraw
211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
\section1 Designing UI Made Simpler \raw HTML <div class="table"> <table style="background:transparent; border: none"> <tr><td style="width:25%; border: none; vertical-align: top"> \endraw \image qtquickcontrols-example-gallery-android.png \caption Controls gallery example on Android \raw HTML </td><td style="width:30%; border: none; vertical-align: top"> \endraw \image qtquickcontrols-example-gallery-osx.png \caption Controls gallery example on OS X \raw HTML </td><td style="width:45%; border: none; vertical-align: top"> \endraw UI designing can be time consuming if there are not enough tools to help. Qt Quick does reduce the effort considerably compared to the traditional native (C or C++) approach, but the new \l{Qt Quick Controls} and \l{Qt Quick Layouts} take it a step further. These new modules provide ready-to-use UI controls and layouts to enable faster application development and with less code. \raw HTML <br> \endraw Qt Quick Controls and Qt Quick Layouts provide a vast set of UI controls ranging from the most basic TextField and Button to the more complex TableView and TabView. These controls are also made available in \l{Qt Creator: Using Qt Quick Designer}{Qt Quick Designer}. \raw HTML </td></tr> </table> </div> \endraw \section1 Sensor and Location Reacting to sensor value changes and locating a place on the world map are the common use cases supported on most portable devices. Now you can support such use cases in your Qt application using the \l{Qt Sensors} and \l{Qt Positioning} modules. \raw HTML <div class="table"> <table style="background:transparent; border: none"> <tr><td style="width:50%; vertical-align:top;border: none;"> \endraw \image qtsensors_accelbubble_ex.jpg \caption Accelerating SVG image \raw HTML </td><td style="width:50%; vertical-align:top;border: none;"> \endraw \image qtpositioning_weatherinfo_ex.jpg \caption Location-based weather information \raw HTML </td></tr> </table> </div> \endraw \section1 Qt Cloud Backend Enginio is the backend for Qt Cloud Services. New in Qt 5.3, the \l{Enginio Manual}{Enginio} module combines a \e{no-SQL} object approach with JSON and Qt APIs to provide applications a reliable and
281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
powerful storage capability. The C++ and QML APIs provided by the new module interact with the Qt Cloud servers from Digia. \list \li \l{Qt Cloud Services} by Digia \li \l{Enginio Manual}{Enginio} - API for developers \endlist \section1 Web Engine and HTML5 \raw HTML <div class="table"> <table style="background:transparent; border: none"> <tr><td colspan=2 style="width:50%; border: none; vertical-align: top"> \endraw \image qtwebengine_quicknanobrowser.jpg \caption Qt Quick nano browser \raw HTML </td><td style="width:50%; border: none; vertical-align: top"> \endraw \l{Qt WebEngine} is a web content rendering engine based on Chromium featuring broad support for standard web technologies. It provides integration with both Qt Quick and traditional widgets. The module brings the latest in HTML5 advancements to Qt 5, including CSS filters, animations and video, and Canvas. \raw HTML <br> \endraw This Chromium-based Web Engine support in Qt is complemented with \l{Qt WebChannel}, which bridges the gap between QML/C++ and HTML/JavaScript. It enables sharing QObjects from QML/C++ with HTML/JavaScript-based clients. \raw HTML </td></tr> </table> </div> \endraw \section1 Multimedia \raw HTML <div class="table"> <table style="background:transparent; border: none"> <tr><td colspan=2 style="width:50%; border: none; vertical-align: top"> \endraw \l {Qt Multimedia} provides a rich set of QML types and C++ classes to handle multimedia content. It also provides necessary APIs to access the camera and radio functionality. Qt 5 brings the Qt Multimedia module into the set of essential modules with support on all major platforms. \raw HTML </td><td style="width:50%; border: none;"> \endraw \image qt5_video.jpg \caption Video embedded into a Qt Quick application with a displacement effect \raw HTML </td></tr> </table> </div> \endraw \section1 Platform-specific Extras Qt is a cross-platform development framework enabling you to target multiple platforms with a single codebase. It provides common APIs across all supported platforms to access a feature without having to worry about how that feature is implemented on a platform. In some applications there will be a need to use a platform-specific feature, and that's when the following modules can be useful:
351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
\list \li \l{Qt Android Extras} enables you to integrate Java code into your Qt application. \li \l{Qt Mac Extras} enables you to access specific features on OS X and iOS. \li \l{Qt Windows Extras} enables you to use Windows-specific features such as jump lists, progress indicator on a taskbar button, and so on. \li \l{Qt X11 Extras} enables you to access the display configuration on Linux (X11). \endlist \section1 Modularized Qt Libraries Qt 5 splits the Qt libraries into domain specific libraries and modules. This means that an application can choose which libraries it requires and only compile, use and deploy those. For a complete list of modules and libraries, see \l {All Modules}{all Qt modules}. \section2 Widgets in Qt 5 The \l {Qt Widgets} have been separated into their own module in Qt 5, the Qt Widgets module. It is part of the essential modules. \raw HTML <div class="table"> <table style="background:transparent; border: none"> <tr><td colspan=2 style="width:50%; border: none; vertical-align: top"> \endraw \image qt5_widgets.jpg \caption Screen capture of a widget application. \raw HTML </td></tr> </table> </div> \endraw Designing the UI for widget-based applications can be quick with \l{Qt Designer Manual}{Qt Designer}. \section1 Qt Platform Abstraction The windowing system dependent parts of Qt have been completely rewritten for Qt 5, based on the Qt Platform Abstraction, a plugin architecture which allows Qt to dynamically load a windowing system integration based on what system it is running on. This gives several benefits: \list \li Centralize the windowing system integration codebase into classes shared for all platforms. \li Simplify the work required when porting Qt to new platforms. \li Remove the windowing system dependency from Qt, making it possible to have the same Qt binaries run against multiple windowing systems. For instance, the Qt Linux binaries can run against both X11 and Wayland. \endlist \section1 New Connection Syntax In addition to the still available well known way to connect signals and slots,
421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
new overloads of QObject::connect have been added allowing you to connect signals and slot using pointer to member functions: \code QObject::connect(sender, &Sender::valueChanged, receiver, &Receiver::updateValue); \endcode The new syntax provides compile time checking of the compatibility between signals and slots, automatic conversion of the arguments if there is an implicit cast between the types, and solve many problems occurring because of typedef or namespaces. Additionally, if your compiler supports C++11 lambdas, you can even connect directly to a lambda function. \code connect(sender, &QObject::destroyed, [=](){ this->m_objects.remove(sender); }); \endcode For a detailed comparison with the original string-based syntax, see \l{Differences between String-Based and Functor-Based Connections}. \section1 Connectivity and Networking Qt 5 provides better support for IPv6 and dual mode networks. Most applications using host names and network layer transparent protocols can now gain IPv6 support transparently. Such applications can also choose to receive both IPv4 and IPv6 connections or bind to only one of the two connection types. In the case of outgoing HTTP connections using \c{QNetworkAccessManager}, both IPv4 and IPv6 connections are attempted in parallel, and the one that succeeds first is used. This is useful in environments where one of the two types has limited connectivity. Qt 5 also provides better ways to handle TCP socket-based connections and SSL certificates. This means developers can now: \list \li bind a TCP socket to an IP address before connecting, \li verify an SSL certificate chain, \li and access legacy systems. \endlist Stricter client authentication is one of the primary concerns for many applications handling confidential or critical data. The opaque Private Keys support in Qt 5 enables applications to read private keys from devices such as PKCS#11 dongles for stricter client authentication. The \l{qsslkey example} illustrates reading private keys from a device. \section2 Extended Connectivity The connectivity options are endless with Qt 5. The two new modules, \l{Qt Bluetooth} and \l{Qt NFC}, enable developers to add support for sophisticated ways to connect and share information in their application. \section1 JSON Support Qt applications that use simple data structures to store small amount of data, can now choose to use JSON documents over the complex database backends that need necessary drivers or plugins to access data. The fact that JSON is a text-based open standard derived from JavaScript, makes it the obvious choice for QML applications as well. The Qt Core provides a set of classes to enable parsing and generating JSON documents. These classes also allow you to convert between an in-memory binary representation of JSON to a standard textual JSON format. The goal is to make common operations on JSON faster. \section1 User Input Qt 4 already had support for handling multi-point touch input in C++. Qt 5 extends this support to include Qt Quick, covering all the information about the touch points, including the touch
491492493494495496497498499500501502503504505506507508509510511512513514515
position, pressure, and velocity. The mouse event handling in Qt 5 has been improved from its predecessor. Applications have more control to handle mouse events in Qt Quick. The mouse area in a QML document can propagate the mouse wheel and click events and also ignore propagated events. Besides this, Qt 5 adds support for more mouse buttons on platforms where this is supported. This comes in handy for gaming applications developed using Qt. \section1 Related Topics \list \li \l{What's New in Qt 5.6} \li \l{What's New in Qt 5.5} \li \l{What's New in Qt 5.4} \li \l{What's New in Qt 5.3} \li \l{What's New in Qt 5.2} \li \l{What's New in Qt 5.1} \li \l{What's New in Qt 5.0} \li \l{Porting Guide} \endlist */