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