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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user