summaryrefslogtreecommitdiffstats
path: root/src/imports/multimedia/multimedia.cpp
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-04-08 15:10:00 +0200
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-04-09 09:36:34 +0000
commita700ff9674f1e3ca86f279d3041c8e81433be7ca (patch)
tree14e58dde604b228c58da7aa2d105a3a0d82ca753 /src/imports/multimedia/multimedia.cpp
parentddec92543f10d0d16455ba5ba4f450c3fe417644 (diff)
Make the QtMultimedia singleton type a QObject.
It was a QJSValue for the sake of being as lightweight as possible and because we don't actually need any of the QObject features for that type in its current state. However, this implies that type information is not available at runtime. This is a problem for qmlplugindump which currently crashes because it always expects every QML type to have an associated meta object. We can safely make that type a QObject since it doesn't affect source compatibility in any way. This type was bound to become a QObject at some point anyway. Task-number: QTBUG-44299 Change-Id: I2d9b874f15ffc94ed95ef74fadc3b1fd193fe1ef Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/imports/multimedia/multimedia.cpp')
-rw-r--r--src/imports/multimedia/multimedia.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp
index 80dc4f82c..a71c6f1c2 100644
--- a/src/imports/multimedia/multimedia.cpp
+++ b/src/imports/multimedia/multimedia.cpp
@@ -57,6 +57,12 @@ QML_DECLARE_TYPE(QSoundEffect)
QT_BEGIN_NAMESPACE
+static QObject *multimedia_global_object(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
+{
+ Q_UNUSED(qmlEngine)
+ return new QDeclarativeMultimediaGlobal(jsEngine);
+}
+
class QMultimediaDeclarativeModule : public QQmlExtensionPlugin
{
Q_OBJECT
@@ -98,7 +104,7 @@ public:
qmlRegisterType<QSoundEffect>(uri, 5, 3, "SoundEffect");
// 5.4 types
- qmlRegisterSingletonType(uri, 5, 4, "QtMultimedia", QDeclarativeMultimedia::initGlobalObject);
+ qmlRegisterSingletonType<QDeclarativeMultimediaGlobal>(uri, 5, 4, "QtMultimedia", multimedia_global_object);
qmlRegisterRevision<QDeclarativeCamera, 1>(uri, 5, 4);
qmlRegisterUncreatableType<QDeclarativeCameraViewfinder>(uri, 5, 4, "CameraViewfinder",
trUtf8("CameraViewfinder is provided by Camera"));