diff options
author | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-04-08 15:10:00 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-04-09 09:36:34 +0000 |
commit | a700ff9674f1e3ca86f279d3041c8e81433be7ca (patch) | |
tree | 14e58dde604b228c58da7aa2d105a3a0d82ca753 /src/imports/multimedia/qdeclarativemultimediaglobal_p.h | |
parent | ddec92543f10d0d16455ba5ba4f450c3fe417644 (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/qdeclarativemultimediaglobal_p.h')
-rw-r--r-- | src/imports/multimedia/qdeclarativemultimediaglobal_p.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/imports/multimedia/qdeclarativemultimediaglobal_p.h b/src/imports/multimedia/qdeclarativemultimediaglobal_p.h index 6c4dba7f4..192874c23 100644 --- a/src/imports/multimedia/qdeclarativemultimediaglobal_p.h +++ b/src/imports/multimedia/qdeclarativemultimediaglobal_p.h @@ -46,12 +46,32 @@ // #include <QtQml/qqml.h> +#include <QtQml/qjsvalue.h> QT_BEGIN_NAMESPACE -namespace QDeclarativeMultimedia { - QJSValue initGlobalObject(QQmlEngine *, QJSEngine *); -} +class QDeclarativeMultimediaGlobal : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QJSValue defaultCamera READ defaultCamera NOTIFY defaultCameraChanged) + Q_PROPERTY(QJSValue availableCameras READ availableCameras NOTIFY availableCamerasChanged) + +public: + explicit QDeclarativeMultimediaGlobal(QJSEngine *engine, QObject *parent = 0); + + QJSValue defaultCamera() const; + QJSValue availableCameras() const; + +Q_SIGNALS: + // Unused at the moment. QCameraInfo doesn't notify when cameras are added or removed, + // but it might change in the future. + void defaultCameraChanged(); + void availableCamerasChanged(); + +private: + QJSEngine *m_engine; +}; QT_END_NAMESPACE |