Qt 5 的 Qt Multimedia 模块组合 (并替换) 2 个较旧模块,也就是来自 Qt 4 的 Qt Multimedia 模块,和来自 Qt Mobility 的 Qt Multimedia Kit 模块。移植使用来自 Qt 4 的 Qt Multimedia 现有代码可以付出最少努力,但移植使用 Qt Multimedia Kit 代码的过程可能更复杂。 变化特征 章节突显移植相关变化。
另请注意:基于 Widget 的类,譬如 QVideoWidget ,现在在称为 Qt Multimedia 小部件的单独模块中。
Qt Multimedia 有许多新特征:
已移除先前由 Qt Multimedia 或 Qt Multimedia Kit 提供的许多类或函数。
移除特征 | 注意事项 |
---|---|
QMediaImageViewer | 移除此类 (及相关控件和服务),由于它们的功能不适于很多应用程序 |
先前由 Qt Multimedia 或 Qt Multimedia Kit 提供的许多类已以可能影响先前编写代码的方式被改变。该表突显这种改变。
变化特征 | 注意事项 |
---|---|
qmake
工程文件变化
|
先前,要使用 Qt Multimedia Kit,
qmake
工程文件必须包含
CONFIG += mobility MOBILITY + = multimedia 现在,只需编写 QT += multimedia 或者,若想要使用 Widget 类, QT += multimedia multimediawidgets |
名称空间 |
The
QtMultimediaKit
namespace has been renamed to
QMultimedia
. This affects a few enumerations, namely
SupportEstimate
,
EncodingQuality
,
EncodingMode
and
AvailabilityStatus
. Searching and replacing
QtMultimediaKit
with
QMultimedia
will greatly aid porting efforts. Metadata have been split off into their own namespace,
QMediaMetaData
.
|
元数据类型 |
In Qt Multimedia Kit, pre-defined metadata keys were enumerations in the
QtMultimediaKit
namespace. These pre-defined keys have been changed to string literals in the
QMediaMetaData
namespace, for consistency with extended keys.
|
元数据访问器方法 |
In Qt Multimedia Kit, there were two different families of methods to access metadata. Functions such as
QMediaObject::metaData()
operated on pre-defined metadata using enumerated keys, while functions such as
QMediaObject::extendedMetaData()
operated on extended metadata using string keys. Qt 5 combines both families into one (e.g.
QMediaObject::metaData
()), which can operate on both pre-defined and extended metadata, using string keys.
|
Qt Metatype 配准 | Qt 5 registers many more classes and types with the meta-object system than before. If you have previously applied Q_DECLARE_METATYPE macros to any Qt Multimedia class, you will probably need to remove them. |
QSoundEffect availability | The SoundEffect QML type was publicly accessible in Qt Multimeda Kit, and now the C++ version is officially public too. If your code contains the previously undocumented QSoundEffect , you may need to update it. |
摄像头控件 | A large number of the camera controls ( QCameraImageProcessingControl , QCameraFocusControl , etc.) have been updated to address a number of design flaws. In particular, a number of discrete accessor methods have been collapsed into parametrized methods, and the ranges or data types of some parameters have been adjusted. |