Qt 5.15 的新功能

Qt 5.15 中的新特征

Qt 3D 模块

  • 改进剖分析和故障诊断支持。
  • QSortPolicy:引入统一模式以控制是否需要统一缩小率。
  • QMouseDevice: 引入 updateAxesContinuously 特性。
  • 孤立 OpenGL 渲染器作为插件。

Qt Core 模块

  • 引入 QFile::moveToTrash () 以提供跨平台 API,用于把文件移至 Windows、macOS 及 Linux 桌面的 trash/recycling (垃圾桶/回收站) bin。这实现 freedesktop.org specification .
  • 引入 QFileInfo::isJunction () 去检测文件系统条目是否为 Windows NTFS 结。
  • QRunnable instances can now be created from std::function without having to subclass QRunnable .
  • QThreadPool::start () 和 tryStart () can now take std::function and thereby also anonymous lambda functions as arguments.
  • Added static template QDebug::toString() function, which streams the given object into a QDebug instance that operates on a string, and then returns that string. This is useful for cases where you need the textual representation of an object for debugging, but cannot use operator<< , such as when passing a failure message to QVERIFY2 ().

Qt GUI 模块

Qt Multimedia 模块

  • 弃用所有插件 API。
  • 弃用 QMediaService 和 QMediaControl。
  • 为 GStreamer 引入反向回放。
  • 引入渲染到多表面。
  • 引入 QVideoWidget::videoSurface ()、QGraphicsVideoItem::videoSurface() 及 QDeclarativeVideoOutput::videoSurface()。
  • MediaPlayer QML 类型:引入 videoOutput 特性。
  • 引入 QVideoFrame::image ().
  • GStreamer camerabin: React to changes in notify::zoom and notify::max-zoom 特性。

Qt Network 模块

  • OpenSSL 后端:添加对 TLS 1.3 协议引入的新会话票证机制的支持。
  • 实现超时为下载和上传采用 QNetworkRequest and QNetworkAccessManager .
  • 把 OpenSSL 版本最小支持增加到 1.1。

Qt QML 模块

  • 引入内联组件;可以在同一文件中声明多个 QML 组件。
  • 引入所需特性。
  • 添加向 QML 注册类型的声明方式。
  • qmllint now has a better understanding of the code and warns about deprecated QML features.
  • 添加 qmlformat tool to automatically format any QML file according to the QML 编码约定 .
  • 添加支持 Nullish Coalescing Operator .
  • 添加 colorspace property on image nodes, making it possible to read color spaces and transform images into a specific color space.

Qt Quick 模块

  • 添加 PathText type which can be used together with Qt Quick Shapes to render text as geometry, without relying on distance fields or pre-rendered textures. This is useful for rendering large font sizes which would otherwise consume a lot of texture memory.
  • 添加 Image.sourceClipRect property to request the image plugin to render a portion of an image source.
  • 添加 cursorShape property to pointer handlers. Most pointer handlers (for example DragHandler ) will change the cursor when in active state. HoverHandler will change the cursor when the mouse is hovering over the Item that contains the handler.
  • Added support for Metal on iOS for the opt-in preview of the Graphics API Independent Rendering Architecture .

Qt Quick Controls 模块

Qt WebEngine 模块

  • 更新至 Chromium 80。
  • 切换到使用沙盒网络服务。
  • 引入新 API,为读取页面 (或视图) 的子进程 ID。
  • 引入 WebEngineHistory.clear () 方法。

工具

  • QDoc can now generate DocBook.
  • QDoc now generates output for C++ class and function template parameters.
  • QDoc now generates correct output for scoped enums (enum classes).

平台的变化

Android

  • 引入默认使用 Android 本机文件对话框用于打开 (文件、多个文件、目录) 和保存操作。

Wayland

  • 在客户端侧引入实验性 Vulkan 支持。

Embedded Linux (eglfs)

  • eglfs_viv backend: Added support for Vulkan, via VK_KHR_display, on NXP i.MX8 based devices.

新模块

Qt Quick 3D

  • 引入后期处理效果。
  • 引入自定义几何图形 API (C++ 网格)。
  • 引入用于节点旋转的四元数 API。
  • 切换到使用右手坐标系统 (以前是右或左)。
  • 改进在 3D 场景中对 Qt Quick 2D 的支持。
  • 添加支持聚光灯。
  • 性能改进。

Qt Lottie

  • 引入 Bodymovin JSON 渲染器为 Adobe After Effects 动画。
  • 改进性能和稳定性。

Qt PDF

  • Based on a version of Pdfium that is shared with Qt WebEngine.
  • 可用于如 Qt WebEngine 的相同平台,及 iOS。

弃用模块

To help preparing for the transition to Qt 6, numerous classes and member functions that will be removed from Qt 6.0 have been marked as deprecated in the Qt 5.15 release. Unless you define QT_NO_DEPRECATED_WARNINGS in your project, you will get compiler warnings for code that uses any deprecated APIs. Those warnings will explain which API to use instead. To disable any deprecated APIs completely, use the QT_DISABLE_DEPRECATED_BEFORE 宏。

下列模块是 Qt 5.15 发行的一部分,但被弃用且在后续 Qt 发行中考虑移除:

  • Qt Script
  • Qt Quick Controls 1
  • Qt XML Patterns

API 变化列表

以下页面包含 Qt 5.15 中的 API 变化列表:

其它 Qt 5 发行的补充