diff options
author | Jochen Seemann <seemann.jochen@gmail.com> | 2016-08-30 22:43:28 +0200 |
---|---|---|
committer | Jochen Seemann <seemann.jochen@gmail.com> | 2018-02-01 19:37:39 +0000 |
commit | 6026ebd7af864912aa37faa3c15d43195c650d82 (patch) | |
tree | 85336a4f6c67e0d4eccbca3ba9001add5c9c0551 /src/imports | |
parent | 1e3c4234a9a505d548db4a3dbc0ebabd5bbe8ed3 (diff) | |
download | qtmultimedia-6026ebd7af864912aa37faa3c15d43195c650d82.tar.gz |
add property supportedExposureModes to CameraExposure
Task-number: QTBUG-45336
Change-Id: I9b4f3271f7f56b88f2484f56dd1d37e2e97f5118
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/multimedia/multimedia.cpp | 2 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativecameraexposure.cpp | 29 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativecameraexposure_p.h | 3 |
3 files changed, 34 insertions, 0 deletions
diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp index 96994b9bf..28829adfb 100644 --- a/src/imports/multimedia/multimedia.cpp +++ b/src/imports/multimedia/multimedia.cpp @@ -156,6 +156,8 @@ public: qmlRegisterType<QDeclarativeAudio, 3>(uri, 5, 11, "MediaPlayer"); qmlRegisterUncreatableType<QDeclarativeCameraFocus, 1>(uri, 5, 11, "CameraFocus", trUtf8("CameraFocus is provided by Camera")); + qmlRegisterUncreatableType<QDeclarativeCameraExposure, 1>(uri, 5, 11, "CameraExposure", + trUtf8("CameraExposure is provided by Camera")); qmlRegisterType<QDeclarativeMediaMetaData>(); qmlRegisterType<QAbstractVideoFilter>(); diff --git a/src/imports/multimedia/qdeclarativecameraexposure.cpp b/src/imports/multimedia/qdeclarativecameraexposure.cpp index 92972e512..af8c6acf6 100644 --- a/src/imports/multimedia/qdeclarativecameraexposure.cpp +++ b/src/imports/multimedia/qdeclarativecameraexposure.cpp @@ -107,6 +107,14 @@ QDeclarativeCameraExposure::QDeclarativeCameraExposure(QCamera *camera, QObject connect(m_exposure, SIGNAL(shutterSpeedChanged(qreal)), this, SIGNAL(shutterSpeedChanged(qreal))); connect(m_exposure, SIGNAL(exposureCompensationChanged(qreal)), this, SIGNAL(exposureCompensationChanged(qreal))); + connect(camera, &QCamera::statusChanged, [this](QCamera::Status status) { + if (status != QCamera::UnloadedStatus && status != QCamera::LoadedStatus + && status != QCamera::ActiveStatus) { + return; + } + + emit supportedExposureModesChanged(); + }); } QDeclarativeCameraExposure::~QDeclarativeCameraExposure() @@ -369,6 +377,27 @@ void QDeclarativeCameraExposure::setExposureMode(QDeclarativeCameraExposure::Exp emit exposureModeChanged(exposureMode()); } } + +/*! + \qmlproperty list<ExposureMode> QtMultimedia::CameraExposure::supportedExposureModes + + This property holds the supported exposure modes of the camera. + + \since 5.11 + \sa exposureMode + */ +QVariantList QDeclarativeCameraExposure::supportedExposureModes() const +{ + QVariantList supportedModes; + + for (int i = int(ExposureAuto); i <= int(QCameraExposure::ExposureBarcode); ++i) { + if (m_exposure->isExposureModeSupported((QCameraExposure::ExposureMode) i)) + supportedModes.append(QVariant(i)); + } + + return supportedModes; +} + /*! \property QDeclarativeCameraExposure::spotMeteringPoint diff --git a/src/imports/multimedia/qdeclarativecameraexposure_p.h b/src/imports/multimedia/qdeclarativecameraexposure_p.h index 806cb775e..ef99b1ce9 100644 --- a/src/imports/multimedia/qdeclarativecameraexposure_p.h +++ b/src/imports/multimedia/qdeclarativecameraexposure_p.h @@ -73,6 +73,7 @@ class QDeclarativeCameraExposure : public QObject Q_PROPERTY(qreal manualIso READ manualIsoSensitivity WRITE setManualIsoSensitivity NOTIFY manualIsoSensitivityChanged) Q_PROPERTY(ExposureMode exposureMode READ exposureMode WRITE setExposureMode NOTIFY exposureModeChanged) + Q_PROPERTY(QVariantList supportedExposureModes READ supportedExposureModes NOTIFY supportedExposureModesChanged REVISION 1) Q_PROPERTY(QPointF spotMeteringPoint READ spotMeteringPoint WRITE setSpotMeteringPoint NOTIFY spotMeteringPointChanged) Q_PROPERTY(MeteringMode meteringMode READ meteringMode WRITE setMeteringMode NOTIFY meteringModeChanged) @@ -114,6 +115,7 @@ public: ~QDeclarativeCameraExposure(); ExposureMode exposureMode() const; + QVariantList supportedExposureModes() const; qreal exposureCompensation() const; int isoSensitivity() const; @@ -153,6 +155,7 @@ Q_SIGNALS: void exposureCompensationChanged(qreal); void exposureModeChanged(ExposureMode); + void supportedExposureModesChanged(); void meteringModeChanged(MeteringMode); void spotMeteringPointChanged(QPointF); |