summaryrefslogtreecommitdiffstats
path: root/src/imports/multimedia/qdeclarativecameracapture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/multimedia/qdeclarativecameracapture.cpp')
-rw-r--r--src/imports/multimedia/qdeclarativecameracapture.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/imports/multimedia/qdeclarativecameracapture.cpp b/src/imports/multimedia/qdeclarativecameracapture.cpp
index 32f3cfc37..22d87ec22 100644
--- a/src/imports/multimedia/qdeclarativecameracapture.cpp
+++ b/src/imports/multimedia/qdeclarativecameracapture.cpp
@@ -112,6 +112,9 @@ QDeclarativeCameraCapture::QDeclarativeCameraCapture(QCamera *camera, QObject *p
connect(m_capture, SIGNAL(error(int,QCameraImageCapture::Error,QString)),
this, SLOT(_q_captureFailed(int,QCameraImageCapture::Error,QString)));
+ connect(m_camera, SIGNAL(statusChanged(QCamera::Status)),
+ this, SLOT(_q_cameraStatusChanged(QCamera::Status)));
+
QMediaService *service = camera->service();
m_metadataWriterControl = service ? service->requestControl<QMetaDataWriterControl*>() : 0;
}
@@ -239,6 +242,15 @@ void QDeclarativeCameraCapture::_q_captureFailed(int id, QCameraImageCapture::Er
qWarning() << "QCameraImageCapture error:" << message;
emit captureFailed(id, message);
}
+
+void QDeclarativeCameraCapture::_q_cameraStatusChanged(QCamera::Status status)
+{
+ if (status != QCamera::UnloadedStatus && status != QCamera::LoadedStatus &&
+ status != QCamera::ActiveStatus)
+ return;
+
+ emit supportedResolutionsChanged();
+}
/*!
\property QDeclarativeCameraCapture::resolution
@@ -251,6 +263,8 @@ void QDeclarativeCameraCapture::_q_captureFailed(int id, QCameraImageCapture::Er
This property holds the resolution/size of the image to be captured.
If empty, the system chooses the appropriate resolution.
+
+ \sa supportedResolutions
*/
QSize QDeclarativeCameraCapture::resolution()
@@ -289,6 +303,24 @@ QString QDeclarativeCameraCapture::errorString() const
}
/*!
+ \qmlproperty list<size> QtMultimedia::CameraCapture::supportedResolutions
+
+ This property holds a list of resolutions which are supported for capturing.
+ The information can be used to set a valid \e resolution. If the camera isn't
+ loaded, the list will be empty.
+
+ \since 5.9
+ \sa resolution
+ */
+QVariantList QDeclarativeCameraCapture::supportedResolutions()
+{
+ QVariantList supportedResolutions;
+ for (const QSize &res : m_capture->supportedResolutions())
+ supportedResolutions.append(QVariant(res));
+ return supportedResolutions;
+}
+
+/*!
\qmlmethod QtMultimedia::CameraCapture::setMetadata(key, value)