What'sNew in Qt 5.5
Qt5.5为最新版,可是开发者为多目标更快地用直观用户界面开发应用。处理触控屏和平板所要求的最新UI范式转换更加容易。Qt5.5中最JavaScript和QML的增强支持,以及有C++基础和Qt Widgit支持,开发者能更高效和灵活。HTML5开发者将对包括Chromium-based Qt WebEngine and Qt WebChannel的WEB一见如故。
Qt5高度兼容Qt 4. Qt4的应用软件的开发者能无缝迁移他们的当前功能,且逐渐开发新的功能,通过借助Qt5的所有的这些伟大的功能,使得成为可能。
借助由必不可少的喝扩展模块组成的新的模块化代码库,以及Qt Platform Abstraction的合并,Qt5的交叉移植能力更加简化。
以下简介了Qt5的一些关键特点:
移动设备上Qt随处可见。
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.
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.
You can install several demo applications that showcase the power of Qt on these mobile platforms. Here is a small list of such applications:
Demo applications: Introduction to Qt 5 (Google Play) Qt 5 Everywhere (Google Play) SubAttack (App Store) QtQuicksand (App Store) Quick Forecast on App Store, Google Play, and Windows Store. Qt Hangman on App Store and Google Play Flyingbus on App Store and Google Play Platform pages: | Qt Everywhere demo on Nexus 7 |
令人吃惊的图形能力和性能
Amazing Graphics Capability and Performance
ShaderEffect on an Image | 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.
The benefits of this architectural change in the rendering engine are well demonstrated by the following projects: Livecoding video effects with Qt5 - The Big Buck Bunny you never saw before. Video effects created using Qt Quick. Pimp my video - Video effects implemented using the shader language with QML. QtMediaHub - The power and convenience of Qt Quick. QtonPi - Good example of Qt 5 running on the low cost hardware, Raspberry PI. |
Qt5中的Qt Quick2.0
Qt Quick in Qt 5,增加了一个新类,替代旧的类QDeclarative*
Qt Quick(2.0) 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: Canvas for drawing. Canvas provides an API that is similar to the HTML5 Canvas API, along with some additional features. Shader Effects which enable GLSL shader programs to be integrated directly into QML code and applied to items and images. Particle Effects for creating a variety of 2D particle systems. Sprites can be used in animating 2D graphical objects and as a source for particle systems. Offline storage is a JavaScript API that conforms with the HTML5 Web Database API for storing data in Qt Quick applications. 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. OpenGL-based rendering architecture for optimal performance. | Qt Quick's Particle System |
The 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. | Excerpts from the Qt Graphical Effects module |
设计UI模式更简单
Designing UI Made Simpler
Controls gallery example on Android | Controls gallery example on OS X | 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 Qt Quick Controls and 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.
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 Qt Quick Designer. |
传感器和定位
Sensor and Location
Reacting to sensor value changes and locating a place onthe world map are the common use cases supported on most portable devices. Nowyou can support such use cases in your Qt application using the Qt Sensors and Qt Positioningmodules.
使用Qt传感器和Qt定位模型
Accelerating SVG image | Location-based weather information |
Qt云后台
Qt Cloud Backend,组合JSON和QtAPIs与非结构化NO-SQL对象方法来为软件提供一个可靠和强有力的存储能力。
Enginio is the backend for Qt Cloud Services. New in Qt5.3, the Enginio modulecombines a no-SQL object approach with JSON and Qt APIs to provideapplications a reliable and powerful storage capability. The C++ and QML APIsprovided by the new module interact with the Qt Cloud servers from Digia.
Qt Cloud Servicesby Digia
Enginio- API for developers
Web引擎和HTML5
Web Engine and HTML5
Qt Quick nano browser纳米浏览器 | 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.
This Chromium-based Web Engine support in Qt is complemented with Qt WebChannel, which bridges the gap between QML/C++ and HTML/JavaScript. It enables sharing QObjects from QML/C++ with HTML/JavaScript-based clients. |
Multimedia多媒体
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. | Video embedded into a Qt Quick application with a displacement effect |
特定平台的附加部分
Qt is a cross-platform development framework enabling youto target multiple platforms with a single codebase. It provides common APIsacross all supported platforms to access a feature without having to worryabout how that feature is implemented on a platform. In some applications therewill be a need to use a platform-specific feature, and that's when thefollowing modules can be useful:
QtAndroid Extras enables you to integrate Java code into your Qt application.
QtMac Extras enables you to access specific features on OS X and iOS.
QtWindows Extras enables you to use Windows-specific features such as jumplists, progress indicator on a taskbar button, and so on.
QtX11 Extras enables you to access the display configuration on Linux (X11).
模块化的Qt库
Qt 5 splits the Qt libraries into domain specificlibraries and modules. This means that an application can choose whichlibraries it requires and only compile, use and deploy those.
For a complete list of modules and libraries, see all Qt modules.
Qt5中的widgets
The Qt Widgetshave been separated into their own module in Qt 5, the Qt Widgets module. It ispart of the essential modules.
Screen capture of a widget application. |
Designing the UI for widget-based applications can bequick with Qt Designer.
Qt平台抽象
The windowing system dependent parts of Qt have beencompletely rewritten for Qt 5, based on the Qt Platform Abstraction, a pluginarchitecture which allows Qt to dynamically load a windowing system integrationbased on what system it is running on. This gives several benefits:
Centralize the windowing system integration codebase intoclasses shared for all platforms.
Simplify the work required when porting Qt to newplatforms.
Remove the windowing system dependency from Qt, making itpossible to have the same Qt binaries run against multiple windowing systems.For instance, the Qt Linux binaries can run against both X11 and Wayland.
新的信号-槽连接语法
In addition to the still available well known way toconnect signals and slots, new overloads of QObject::connect havebeen added allowing you to connect signals and slot using pointer to memberfunctions:
允许使用成员函数的指针来链接信号和槽。
QObject::connect(sender,&Sender::valueChanged, receiver, &Receiver::updateValue);
The new syntax provides compile time checking of thecompatibility between signals and slots, automatic conversion of the argumentsif there is an implicit cast between the types, and solve many problemsoccurring because of typedef or namespaces.
Additionally, if your compiler supports C++11 lambdas,you can even connect directly to a lambda function.
如果你的编译器支持C++11lambdas,你甚至能直接连接到lambda函数。
connect(sender,&QObject::destroyed,[=](){ this->m_objects.remove(sender); });
For a detailed comparison with the original string-basedsyntax, see Differencesbetween String-Based and Functor-Based Connections.
连接性和网络化
支持IPv6或者双模网络,谁先连上,就先使用谁。
Qt 5 provides better support for IPv6 and dual modenetworks. Most applications using host names and network layer transparentprotocols can now gain IPv6 support transparently. Such applications can alsochoose to receive both IPv4 and IPv6 connections or bind to only one of the twoconnection types. In the case of outgoing HTTP connections using QNetworkAccessManager, both IPv4and IPv6 connections are attempted in parallel, and the one that succeeds firstis used. This is useful in environments where one of the two types has limitedconnectivity.
Qt 5 also provides better ways to handle TCP socket-basedconnections and SSL certificates. This means developers can now:
bind a TCP socket to an IP address before connecting,
verify an SSL certificate chain,
and access legacy systems.
连接前绑定TCP套接字和一个IP地址。
校验一个SSL认证链接
访问旧系统
Stricter client authentication is one of the primaryconcerns for many applications handling confidential or critical data. Theopaque Private Keys support in Qt 5 enables applications to read private keysfrom devices such as PKCS#11 dongles for stricter client authentication. The qsslkey example illustratesreading private keys from a device.
支持PKCS11,OPK。
The connectivity options are endless with Qt 5. The twonew modules, QtBluetooth and Qt NFC,enable developers to add support for sophisticated ways to connect and shareinformation in their application.
支持蓝牙和NFC
JSON Support
Qt applications that use simple data structures to storesmall amount of data, can now choose to use JSON documents over the complex databasebackends that need necessary drivers or plugins to access data. The fact thatJSON is a text-based open standard derived from JavaScript, makes it theobvious choice for QML applications as well.
支持JSON,从JavaScript导出的基于文本的开放标准。
The Qt Core provides a set of classes to enable parsingand generating JSON documents. These classes also allow you to convert betweenan in-memory binary representation of JSON to a standard textual JSON format.The goal is to make common operations on JSON faster.
用户输入
Qt4中支持多点触控输入用c++。Qt5扩展到支持Qt Quick。涵盖了包括触控点所有的信息,如触控点,压力和速度。
Qt 4 already had support for handling multi-point touchinput in C++. Qt 5 extends this support to include Qt Quick, covering all theinformation about the touch points, including the touch position, pressure, andvelocity.
The mouse event handling in Qt 5 has been improved fromits predecessor. Applications have more control to handle mouse events in QtQuick. The mouse area in a QML document can propagate the mouse wheel and clickevents and also ignore propagated events.
Besides this, Qt 5 adds support for more mouse buttons onplatforms where this is supported. This comes in handy for gaming applicationsdeveloped using Qt.
What's New in Qt 5.4
The focus for Qt 5.4 is mainly about improving thestability, performance, and first-time user experience of the product.
-
WinRT now a supportedplatform
-
Windows Phone 8.1minimum supported version
-
QOpenGLContext is now ableto adopt existing native contexts (EGL, GLX, and so on). This allowsinteroperability among Qt and other frameworks, such as game engines.
-
OpenGL ES 3.0/3.1support is improved. The header file for the highest usable ES version (gl31.h,gl3.h or gl2.h) is now automatically included by Qt's headers in -opengl es2builds. Vertex array objects, framebuffer blits and multisampling are nowsupported via the standard GLES3 functions, where applicable.
-
Selecting the dynamicOpenGL implementation on application startup is now available on Windows whenconfigured with _-opengl dynamic_. This allows using either opengl32.dll orANGLE's OpenGL ES 2.0 implementation in Qt and applications without the needfor two separate builds of the binaries.
-
QOpenGLWidget: The modernreplacement for QGLWidget and the counterpart of QQuickWidget.
-
QOpenGLWindow: Convenienceclass for performing OpenGL drawing onto a QWindow.
-
QRasterWindow: Covenienceclass for performing software-based drawing via QPainter onto a QWindow.
-
Support for 10-bit percolor channels images. These can be rendered to and from, though internally theraster engine will still use 8-bit per color channel. If used as the internalformat of a QOpenGLFramebufferObject,the OpenGL paint engine is able to render in full precision if supported by theOpenGL driver.
-
WinRT: Added supportfor native file dialogs.
-
WinRT: Added supportfor native settings container (local and roaming).
-
QStorageInfo: Class forproviding information about currently mounted storage volumes and drives.
-
QByteArrayList:Convenience class adding similar extra methods on top of QList<QByteArray> as QStringList does to QList<QString>.
-
QTabletEvent: severalimprovements to the input information: added information about the stylusbuttons being pressed, the rotation and tangential pressures now have consistentranges across platforms, the proximity events now include the type of stylus orother tool in use, and manual tests and debug output are improved for betterverification of functionality.
-
QQuickRenderControlis made public. This API allows efficient rendering of Qt Quick 2 scenes intoframebuffer objects. The contents can then be used in arbitrary ways in Qt-basedor 3rd party OpenGL renderers.
-
Introduced overlay andpull back headers and footers for ListView.
-
AddedQQuickFontMetrics, which provides a subset of QFontMetricsF's API.
-
AddedQQuickTextMetrics, which provides a declarative API for the QFontMetricsF functionarguments.
-
QQuickWidget is nowsupported on Android.
-
Native Androidstyle support on Android v3.0 or later.
-
Support for Bluez5.
-
Tech Preview ofBluetooth Low Energy (client side support only, on Bluez 4 & 5).
-
The Wayland platformplugin is now part of the release.
-
XCB will now supportscreen with a depth of 30 (10 bit per color channel).
-
More font settings areparsed by fontconfig and GTK platform backends.
-
More categorizedlogging is in use so that you can enable it in the standard ways (qtlogging.inietc.) instead of needing to set obscure environment variables or uncomment#defines. The log also provides more complete information, especially aboutevents.
-
Support for integerdevice pixel ratios larger than one has been added to the XCB plugin. The ratiois controlled by the environment variable QT_DEVICE_PIXEL_RATIO.
-
Added support forOpenGL accelerated 2D canvas to Qt WebKit Widgets.
-
The Qt WebKit moduleis considered done. It will be replaced by Qt WebEngine. This applies tothe widgets as well as to the QML API of Qt WebKit.
-
The Qt OpenGL module(which contain classes that start with QGL) is now deprecated in favorof the Qt GUI module(which contains classes that start with QOpenGL). QGLWidget can now bereplaced by QOpenGLWidget.
The pages below contain a list of API changes in Qt 5.4:
所有模块
All Modules
Qt Essentials
Qt essentials define the foundation of Qt on all platforms. They areavailable on all supported development platforms and on the tested targetplatforms. They will remain source and binary compatible during Qt 5.
Essential modules are general and useful for a majority of Qt applications.A module that is used for a special purpose is considered an add-on module evenif it is available on all supported platforms.
精华模块是对所有平台适用的,在QT5期间保持源代码和二进制兼容。特定目的的模块作为扩展模块。
The following table lists the Qt essentials:
Module | Description |
Core non-graphical classes used by other modules. 被别的模块使用的核心非图形类 | |
Base classes for graphical user interface (GUI) components. Includes OpenGL. 用户GUI组件的基类,包括OpenGL | |
Classes for audio, video, radio and camera functionality. 音频、视频、无线电和相机功能的类 | |
Widget-based classes for implementing multimedia functionality. 实行多媒体功能的基于Widget的类 | |
Classes to make network programming easier and more portable. 使网络编程更容易和更易移植的类 | |
Classes for QML and JavaScript languages. 用于QML和JavaScript语言的类 | |
A declarative framework for building highly dynamic applications with custom user interfaces. 用于构建带定制用户接口的高度动态应用的声明性框架 | |
Reusable Qt Quick based UI controls to create classic desktop-style user interfaces. 创建经典的桌面风格用户界面的基于可重用的Qt Quick的UI控件 | |
Types for creating and interacting with system dialogs from a Qt Quick application. 来自Qt Quick应用软件的用于创建和交互式系统对话框的类型 | |
Layouts are items that are used to arrange Qt Quick 2 based items in the user interface. 布局是一个项目,用于排列在用户接口中基于项目的Qt Quick2 | |
Classes for database integration using SQL. 用SQL的数据集成类 | |
Classes for unit testing Qt applications and libraries. 用于单元测试Qt应用软件和库的类。 | |
Qt WebKit (Deprecated) (已弃用) | Classes for a WebKit2 based implementation and a QML API. Deprecated in favor of Qt WebEngine. 用于一个基于WebKit2实现和一个QML API的类。为支持Qt WebEngine而弃用 |
Qt WebKit Widgets (Deprecated)弃用 | WebKit1 and QWidget-based classes from Qt 4. 来自Qt4的基于WebKit1 和QWidget的类 |
Classes to extend Qt GUI with C++ widgets. 用C++widgets扩展QtGUI的类。 |
If you use qmaketo build your projects, the QtCore and Qt GUImodules are included by default. To link only against Qt Core, add thefollowing line to your .pro file:
QT -= gui
On Windows, if you do not use qmake or other buildtools such as CMake, youalso need to link against the qtmain library.
Qt扩展
Qt Add-On modules bring additional value for specific purposes. These modules mayonly be available on some development platform. Many add-on modules are eitherfeature-complete and exist for backwards compatibility, or are only applicableto certain platforms. Each add-on module specifies its compatibility promiseseparately.
The Qt installers include the option of downloading the add-ons. For moreinformation, visit the GettingStarted with Qt page.
The following table lists the Qt add-ons:
Module | Development Platforms | Target Platforms | Description |
Classes for applications which use ActiveX and COM | |||
All | All | A Backend-as-a-Service solution to ease the backend development for connected and data-driven applications. | |
All | Provides platform-specific APIs for Android. | ||
All | Provides access to Bluetooth hardware. | ||
All | Enables OpenGL-like 3D drawing calls from Qt Quick applications using JavaScript. | ||
Classes for writing multi-threaded programs without using low-level threading primitives. | |||
All | Classes for inter-process communication over the D-Bus protocol. | ||
All | Graphical effects for use with Qt Quick 2. | ||
All | Plugins for additional image formats: TIFF, MNG, TGA, WBMP. | ||
All | Provides platform-specific APIs for OS X. | ||
All | Provides access to Near-Field communication (NFC) hardware. | ||
OpenGL support classes. Note: Provided to ease porting from Qt 4.x. Please use the QOpenGL classes in Qt GUI for new code | |||
Provides classes that encapsulate platform-specific information, tied to a given runtime configuration of a platform plugin. | |||
All | Provides access to position, satellite and area monitoring classes. | ||
All | Classes to make printing easier and more portable. | ||
Qt Declarative (Deprecated) | All | Qt Declarative is provided for Qt 4 compatibility. The documentation is available through the Qt 4.8 Qt Quick documentation. | |
All | Provides a specialized set of controls that can be used to build interfaces in Qt Quick. | ||
All | Provides a C++ widget class for displaying a Qt Quick user interface. | ||
Qt Script (Deprecated) | All | Classes for making Qt applications scriptable. Provided for Qt 4.x compatibility. Please use the QJS* classes in the Qt QML module for new code. | |
All | Additional components for applications that use Qt Script. | ||
All | Android, Qt for iOS, WinRT and Mer. | Provides access to sensor hardware and motion gesture recognition. | |
All | Provides access to hardware and virtual serial ports. | ||
All | Classes for displaying the contents of SVG files. Supports a subset of the SVG 1.2 Tiny standard. | ||
All | All | Provides access to QObject or QML objects from HTML clients for seamless integration of Qt applications with HTML/JavaScript clients. | |
All | Provides a QML API to run web applications using the Chromium browser project. | ||
All | Provides a C++ API to run web applications using the Chromium browser project. | ||
All | All | ||
All | Provides platform-specific APIs for Windows. | ||
All | Provides platform-specific APIs for X11. | ||
C++ implementations of SAX and DOM. Note: Deprecated, please use QXmlStreamReader and QXmlStreamWriter for new functionality. | |||
Support for XPath, XQuery, XSLT and XML schema validation. |
Value-AddModules增值模块
In addition to the modules released as part of Qt 5, the following modulesand tooling build on top of the Qt libraries to provide additional value. Theyhave their own release schedule, and are available under different Qt licenses.See the Downloads page for moreinformation.
建立于Qt库上的来提供额外价值的模块和工具
Feature | Description |
Tools for fast, easy, and fully-integrated embedded device application development. Includes most other Value-Add features. 用于快速、容易和全集成的嵌入式设备应用软件的开发的工具,包括很多另外的机制增值特性 | |
UI Components for displaying visually pleasing charts, driven by static or dynamic data models. 显示令人愉悦的可视化图标的UI组件,被静态或者动态数据模型驱动。 | |
Enables compiling .qml source files into application binaries, improving load times and security for code assets. 使编译.qml源文件为应用二进制生效,改善了装载时间和安全性,对于代码资产。 | |
UI Components for creating stunning 3D data visualizations. 创建极好的3D数据可视化UI组件 | |
Enables in-app purchase of products in Qt applications on mobile platforms. 在移动平台上,在Qt应用软件中产品内置应用购买的生效 | |
A framework for implementing different input methods as well as a QML virtual keyboard. Supports localized keyboard layouts and custom visual themes. 实现如同QML虚拟键盘的不同输入法的框架,支持局部化键盘布局和定制可视场景。 | |
Enables the use of Qt Quick UI on devices without OpenGL capability. 激活没有OpenGL能力的设备上的Qt Quick UI的使用 |
TechnologyPreview Modules技术预览模块
The following modules are still in development but are available astechnology previews.
Module | Description |
Displays map, navigation, and place content in a QML application. | |
Displays web content in a QML application by using APIs native to the platform, without the need to include a full web browser stack. | |
Functionality for near-realtime simulation systems with support for 2D and 3D rendering. |
Qt Tools
Qt Tools run on all the supported development platforms and facilitate thedevelopment and design of applications.
The following table lists the Qt tools:
Tool | Description |
Classes for extending Qt Designer.扩展Qt Designer的类 | |
Classes for integrating online documentation into applications, similar to Qt Assistant. 用于集成在线文档到应用软件的类,类似于Qt助手 | |
Classes to handle the forms created in Qt Designer. 处理在Qt Designer中创建的表格的类 |