From a09e2b798c64d2d2376dc182cf399401afb56d59 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 22 Sep 2021 10:39:09 +0200 Subject: Fixes to Camera docs and API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Document the Camera QML API. Also add docs for some missing methods on the C++ side. Fix a few API inconsistencies while we still can (qreal->float), and and expose a couple of missing things to QML by adding a few Q_PROPERTY and Q_INVOKABLE macros. Change-Id: I6e91315e9d73336c6a83797f9eef133a9afd8a17 Reviewed-by: Topi Reiniƶ (cherry picked from commit 038410c57a04279e35f4bf7b407713542f3e7a7f) Reviewed-by: Qt Cherry-pick Bot --- src/multimedia/camera/qcamera.cpp | 484 ++++++++++++++++++++++++++++---- src/multimedia/camera/qcamera.h | 24 +- src/multimedia/camera/qcameradevice.cpp | 25 +- src/multimedia/camera/qcameradevice.h | 1 + src/multimediaquick/camerafocus.qdoc | 133 --------- 5 files changed, 464 insertions(+), 203 deletions(-) delete mode 100644 src/multimediaquick/camerafocus.qdoc diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp index 6fa9079e9..7094f169d 100644 --- a/src/multimedia/camera/qcamera.cpp +++ b/src/multimedia/camera/qcamera.cpp @@ -69,35 +69,126 @@ QT_BEGIN_NAMESPACE \snippet multimedia-snippets/camera.cpp Camera selection On hardware that supports it, QCamera lets you adjust the focus - and zoom. This also includes things - like "Macro" mode for close up work (e.g. reading barcodes, or + and zoom. This also includes functionality such as a + "Macro" mode for close up work (e.g. reading barcodes, or recognizing letters), or "touch to focus" - indicating an - interesting area of the viewfinder for the hardware to attempt + interesting area of the image for the hardware to attempt to focus on. \snippet multimedia-snippets/camera.cpp Camera custom focus - The \l minimumZoomFactor() and \l maximumZoomFactor() methods allows checking the - range of allowed zoom factors. The \l zoomTo() method allows changing the zoom factor. + The \l minimumZoomFactor() and \l maximumZoomFactor() methods provide the + range of supported zoom factors. The \l zoomTo() method allows changing + the zoom factor. \snippet multimedia-snippets/camera.cpp Camera zoom - After capturing the data for a camera frame, the camera hardware and - software performs various image processing tasks to produce a final + After capturing the raw data for a camera frame, the camera hardware and + software performs various image processing tasks to produce the final image. This includes compensating for ambient light color, reducing noise, as well as making some other adjustments to the image. + You can control many of these processing steps through the Camera properties. For example, you can set the white balance (or color temperature) used for processing images: \snippet multimedia-snippets/camera.cpp Camera image whitebalance - For more information on image processing of camera frames, see \l {camera_image_processing}{Camera Image Processing}. + For more information on image processing of camera frames, see + \l {camera_image_processing}{Camera Image Processing}. See the \l{Camera Overview}{camera overview} for more information. */ +/*! + \qmltype Camera + \instantiates QCamera + \inqmlmodule QtMultimedia + \brief An interface for camera settings related to focus and zoom. + \ingroup multimedia_qml + \ingroup camera_qml + + The Camera element can be used within a \l CaptureSession for video recording + and image taking. + + You can use \l MediaDevices to list available cameras and choose which one to use. + + \qml + MediaDevices { + id: mediaDevices + } + CaptureSession { + camera: Camera { + device: mediaDevices.defaultVideoInput + } + } + \endqml + + On hardware that supports it, QCamera lets you adjust the focus + and zoom. This also includes functionality such as a + "Macro" mode for close up work (e.g. reading barcodes, or + recognizing letters), or "touch to focus" - indicating an + interesting area of the image for the hardware to attempt + to focus on. + + \qml + + Item { + width: 640 + height: 360 + + CaptureSession { + camera: Camera { + id: camera + + focusMode: Camera.FocusModeAutoNear + customFocusPoint: Qt.point(0.2, 0.2) // Focus relative to top-left corner + } + videoOutput: videoOutput + } + + VideoOutput { + id: videoOutput + anchors.fill: parent + } + } + + \endqml + + The \l minimumZoomFactor and \l maximumZoomFactor properties provide the + range of supported zoom factors. The \l zoomFactor property allows changing + the zoom factor. + + \qml + Camera { + zoomFactor: maximumZoomFactor // zoom in as much as possible + } + \endqml + + After capturing the raw data for a camera frame, the camera hardware and + software performs various image processing tasks to produce the final + image. This includes compensating for ambient light color, reducing + noise, as well as making some other adjustments to the image. + + You can control many of these processing steps through the Camera properties. + For example, you can set the white balance (or color temperature) used + for processing images: + + \qml + Camera { + whiteBalanceMode: Camera.WhiteBalanceManual + colorTemperature: 5600 + } + \endqml + + For more information on image processing of camera frames, see + \l {camera_image_processing}{Camera Image Processing}. + + See the \l{Camera Overview}{camera overview} for more information. +*/ + + void QCameraPrivate::_q_error(int error, const QString &errorString) { Q_Q(QCamera); @@ -207,6 +298,16 @@ bool QCamera::isAvailable() const return d->control && !d->cameraDevice.isNull(); } +/*! \qmlproperty bool QtMultimedia::Camera::active + + Describes whether the camera is currently active. +*/ + +/*! \property bool QCamera::active + + Describes whether the camera is currently active. +*/ + /*! Returns true if the camera is currently active. */ @@ -227,7 +328,15 @@ void QCamera::setActive(bool active) } /*! - Returns the error state of the object. + \qmlproperty enumeration QtMultimedia::Camera::error + + Returns the error state of the camera. + + \sa QCamera::Error +*/ + +/*! + Returns the error state of the camera. */ QCamera::Error QCamera::error() const @@ -235,6 +344,12 @@ QCamera::Error QCamera::error() const return d_func()->error; } +/*! + \qmlproperty string QtMultimedia::Camera::errorString + + Returns a human readable string describing a camera's error state. +*/ + /*! Returns a human readable string describing a camera's error state. */ @@ -243,12 +358,52 @@ QString QCamera::errorString() const return d_func()->errorString; } +/*! \enum QCamera::Features + + Describes a set of features supported by the camera. The returned value can be a + combination of: + + \value ColorTemperature + The Camera supports setting a custom \l{colorTemperature}. + \value ExposureCompensation + The Camera supports setting a custom \l{exposureCompensation}. + \value IsoSensitivity + The Camera supports setting a custom \l{isoSensitivity}. + \value ManualExposureTime + The Camera supports setting a \l{manual exposure Time}{QCamera::manualExposureTime}. + \value CustomFocusPoint + The Camera supports setting a \l{custom focus point}{QCamera::customFocusPoint}. + \value FocusDistance + The Camera supports setting the \l{focusDistance} property. +*/ + +/*! + \qmlproperty Features QtMultimedia::Camera::supportedFeatures + Returns the features supported by this camera. + + \sa QCamera::Features +*/ + +/*! + Returns the features supported by this camera. + + \sa QCamera::Features +*/ QCamera::Features QCamera::supportedFeatures() const { Q_D(const QCamera); return d->control ? d->control->supportedFeatures() : QCamera::Features{}; } +/*! \qmlmethod void Camera::start() + + Starts the camera. + + Same as setActive(true). + + If the camera can't be started for some reason, the errorOccurred() signal is emitted. +*/ + /*! \fn void QCamera::start() Starts the camera. @@ -258,11 +413,16 @@ QCamera::Features QCamera::supportedFeatures() const If the camera can't be started for some reason, the errorOccurred() signal is emitted. */ -/*! \fn void QCamera::stop() +/*! \qmlmethod void Camera::stop() Stops the camera. Same as setActive(false). +*/ +/*! \fn void QCamera::stop() + + Stops the camera. + Same as setActive(false). */ /*! @@ -297,6 +457,11 @@ void QCamera::setCaptureSession(QMediaCaptureSession *session) d->captureInterface->setCamera(d->control); } +/*! \qmlproperty CameraDevice QtMultimedia::Camera::cameraDevice + + Gets or sets the currently active camera device. +*/ + /*! Returns the QCameraDevice object associated with this camera. */ @@ -326,8 +491,17 @@ void QCamera::setCameraDevice(const QCameraDevice &cameraDevice) setCameraFormat({}); } +/*! \qmlproperty CameraDevice QtMultimedia::Camera::cameraFormat + + Gets or sets the currently active camera format. + + \sa CameraDevice::videoFormats +*/ + /*! Returns the camera format currently used by the camera. + + \sa QCameraDevice::videoFormats */ QCameraFormat QCamera::cameraFormat() const { @@ -358,6 +532,13 @@ void QCamera::setCameraFormat(const QCameraFormat &format) \value CameraError An error has occurred. */ +/*! + \qmlsignal void Camera::errorOccurred(Camera::Error error, string errorString) + + This signal is emitted when error state changes to \a error. A description + of the error is provided as \a errorString. +*/ + /*! \fn void QCamera::errorOccurred(QCamera::Error error, const QString &errorString) @@ -366,22 +547,27 @@ void QCamera::setCameraFormat(const QCameraFormat &format) */ /*! - \enum QCameraDevice::Position - \since 5.3 + \qmlproperty enumeration Camera::focusMode - This enum specifies the physical position of the camera on the system hardware. + This property holds the current camera focus mode. - \value UnspecifiedPosition The camera position is unspecified or unknown. + \note In automatic focusing modes and where supported, the \l focusPoint property provides + information and control over the area of the image that is being focused. - \value BackFace The camera is on the back face of the system hardware. For example on a - mobile device, it means it is on the opposite side to that of the screen. + \value Camera.FocusModeAuto Continuous auto focus mode. + \value Camera.FocusModeAutoNear Continuous auto focus, preferring objects near to + the camera. + \value Camera.FocusModeAutoFar Continuous auto focus, preferring objects far away + from the camera. + \value Camera.FocusModeHyperfocal Focus to hyperfocal distance, with the maximum + depth of field achieved. All objects at distances from half of this + distance out to infinity will be acceptably sharp. + \value Camera.FocusModeInfinity Focus strictly to infinity. + \value Camera.FocusModeManual Manual or fixed focus mode. - \value FrontFace The camera is on the front face of the system hardware. For example on a - mobile device, it means it is on the same side as that of the screen. Viewfinder frames of - front-facing cameras are mirrored horizontally, so the users can see themselves as looking - into a mirror. Captured images or videos are not mirrored. + If a certain focus mode is not supported, setting it will have no effect. - \sa QCameraDevice::position() + \sa isFocusModeSupported() */ /*! @@ -394,7 +580,6 @@ void QCamera::setCameraFormat(const QCameraFormat &format) \sa QCamera::isFocusModeSupported() */ - QCamera::FocusMode QCamera::focusMode() const { Q_D(const QCamera); @@ -411,9 +596,14 @@ void QCamera::setFocusMode(QCamera::FocusMode mode) } /*! - Returns true if the focus \a mode is supported by camera. + \qmlproperty bool Camera::isFocusModeSupported(FocusMode mode) + + Returns true if the focus \a mode is supported by the camera. */ +/*! + Returns true if the focus \a mode is supported by the camera. +*/ bool QCamera::isFocusModeSupported(FocusMode mode) const { Q_D(const QCamera); @@ -431,14 +621,29 @@ QPointF QCamera::focusPoint() const } /*! - \property QCamera::customFocusPoint + \qmlproperty point QtMultimedia::Camera::customFocusPoint - This property represents the position of the custom focus point, in relative frame coordinates: - QPointF(0,0) points to the left top frame point, QPointF(0.5,0.5) points to the frame center. + This property holds the position of custom focus point, in relative frame + coordinates. This means that QPointF(0,0) points to the top-left corner + of the frame, and QPointF(0.5,0.5) points to the center of the frame. - The custom focus point property is used only in \c FocusPointCustom focus mode. - */ + Custom focus point is used only in \c FocusPointCustom focus mode. + + You can check whether custom focus points are supported by querying + supportedFeatures() with the Feature.CustomFocusPoint flag. +*/ + +/*! + \property QCamera::customFocusPoint + This property represents the position of the custom focus point, in relative frame coordinates: + QPointF(0,0) points to the left top frame point, QPointF(0.5,0.5) points to the frame center. + + The custom focus point property is used only in \c FocusPointCustom focus mode. + + You can check whether custom focus points are supported by querying + supportedFeatures() with the Feature.CustomFocusPoint flag. +*/ QPointF QCamera::customFocusPoint() const { Q_D(const QCamera); @@ -453,14 +658,27 @@ void QCamera::setCustomFocusPoint(const QPointF &point) d->control->setCustomFocusPoint(point); } +/*! + \qmlproperty float QCamera::focusDistance + + This property return an approximate focus distance of the camera. The value reported + is between 0 and 1, 0 being the closest possible focus distance, 1 being as far away + as possible. Note that 1 is often, but not always infinity. + + Setting the focus distance will be ignored unless the focus mode is set to + \l FocusModeManual. +*/ + /*! \property QCamera::focusDistance - This property return an approximate focus distance of the camera. The value reported is between 0 and 1, 0 being the closest - possible focus distance, 1 being as far away as possible. Note that 1 is often, but not always infinity. + This property return an approximate focus distance of the camera. The value reported + is between 0 and 1, 0 being the closest possible focus distance, 1 being as far away + as possible. Note that 1 is often, but not always infinity. - Setting the focus distance will be ignored unless the focus mode is set to \l FocusModeManual. - */ + Setting the focus distance will be ignored unless the focus mode is set to + \l FocusModeManual. +*/ void QCamera::setFocusDistance(float d) { if (!d_func()->control || focusMode() != FocusModeManual) @@ -475,6 +693,15 @@ float QCamera::focusDistance() const return 0.; } +/*! + \qmlproperty real QtMultimedia::Camera::maximumZoomFactor + + This property holds the maximum zoom factor supported. + + This will be \c 1.0 on cameras that do not support zooming. +*/ + + /*! Returns the maximum zoom factor. @@ -487,6 +714,14 @@ float QCamera::maximumZoomFactor() const return d->control ? d->control->maxZoomFactor() : 1.; } +/*! + \qmlproperty real QtMultimedia::Camera::minimumZoomFactor + + This property holds the minimum zoom factor supported. + + This will be \c 1.0 on cameras that do not support zooming. +*/ + /*! Returns the minimum zoom factor. @@ -500,8 +735,18 @@ float QCamera::minimumZoomFactor() const } /*! - \property QCamera::zoomFactor - \brief The current zoom factor. + \qmlproperty QCamera::zoomFactor + + Gets or sets the current zoom factor. Values will be clamped between + \l minimumZoomFactor and \l maximumZoomFactor. +*/ + +/*! + \property QCamera::zoomFactor + \brief The current zoom factor. + + Gets or sets the current zoom factor. Values will be clamped between + \l minimumZoomFactor and \l maximumZoomFactor. */ float QCamera::zoomFactor() const { @@ -517,11 +762,26 @@ void QCamera::setZoomFactor(float factor) } /*! + \qmlmethod void QtMultimedia::Camera::zoomTo(factor, rate) + Zooms to a zoom factor \a factor using \a rate. The \a rate is specified in powers of two per second. At a rate of 1 it would take 2 seconds to go from a zoom factor of 1 to 4. - */ + + \note Using a specific rate is not supported on all cameras. If not supported, + zooming will happen as fast as possible. +*/ + +/*! + Zooms to a zoom factor \a factor using \a rate. + + The \a rate is specified in powers of two per second. At a rate of 1 + it would take 2 seconds to go from a zoom factor of 1 to 4. + + \note Using a specific rate is not supported on all cameras. If not supported, + zooming will happen as fast as possible. +*/ void QCamera::zoomTo(float factor, float rate) { Q_ASSERT(rate >= 0.); @@ -548,13 +808,21 @@ void QCamera::zoomTo(float factor, float rate) \value FocusModeManual Manual or fixed focus mode. */ +/*! + \qmlproperty Camera::FlashMode QtMultimedia::Camera::flashMode + + Gets or sets a certain flash mode if the camera has a flash. + + \sa QCamera::FlashMode, Camera::isFlashModeSupported(), Camera::isFlashReady() +*/ + /*! \property QCamera::flashMode \brief The flash mode being used. Enables a certain flash mode if the camera has a flash. - \sa QCamera::isFlashModeSupported(), QCamera::isFlashReady() + \sa QCamera::FlashMode, QCamera::isFlashModeSupported(), QCamera::isFlashReady() */ QCamera::FlashMode QCamera::flashMode() const { @@ -570,9 +838,14 @@ void QCamera::setFlashMode(QCamera::FlashMode mode) } /*! + \qmlmethod QtMultimedia::Camera::isFlashModeSupported(FlashMode mode) + Returns true if the flash \a mode is supported. */ +/*! + Returns true if the flash \a mode is supported. +*/ bool QCamera::isFlashModeSupported(QCamera::FlashMode mode) const { Q_D(const QCamera); @@ -580,23 +853,41 @@ bool QCamera::isFlashModeSupported(QCamera::FlashMode mode) const } /*! + \qmlmethod bool QtMultimedia::Camera::isFlashReady() + Returns true if flash is charged. */ +/*! + Returns true if flash is charged. +*/ bool QCamera::isFlashReady() const { Q_D(const QCamera); return d->control ? d->control->isFlashReady() : false; } +/*! + \qmlproperty Camera::TorchMode Camera::torchMode + + Gets or sets the torch mode being used. + + A torch is a continuous source of light. It can be used during video recording in + low light conditions. Enabling torch mode will usually override any currently set + flash mode. + + \sa QCamera::TorchMode, Camera::isTorchModeSupported(), Camera::flashMode +*/ + /*! \property QCamera::torchMode \brief The torch mode being used. - A torch is a continuous light source used for low light video recording. Enabling torch mode - will usually override any currently set flash mode. + A torch is a continuous source of light. It can be used during video recording in + low light conditions. Enabling torch mode will usually override any currently set + flash mode. - \sa QCamera::isTorchModeSupported(), QCamera::flashMode + \sa QCamera::TorchMode, QCamera::isTorchModeSupported(), QCamera::flashMode */ QCamera::TorchMode QCamera::torchMode() const { @@ -611,6 +902,12 @@ void QCamera::setTorchMode(QCamera::TorchMode mode) d->control->setTorchMode(mode); } +/*! + \qmlmethod bool QtMultimedia::Camera::isTorchModeSupported(TorchMode mode) + + Returns true if the torch \a mode is supported. +*/ + /*! Returns true if the torch \a mode is supported. */ @@ -620,13 +917,19 @@ bool QCamera::isTorchModeSupported(QCamera::TorchMode mode) const return d->control ? d->control->isTorchModeSupported(mode) : (mode == TorchOff); } +/*! + \qmlproperty ExposureMode QtMultimedia::Camera::exposureMode + \brief The exposure mode being used. + + \sa QCamera::ExposureMode, Camera::isExposureModeSupported() +*/ + /*! \property QCamera::exposureMode \brief The exposure mode being used. \sa QCamera::isExposureModeSupported() */ - QCamera::ExposureMode QCamera::exposureMode() const { Q_D(const QCamera); @@ -641,9 +944,14 @@ void QCamera::setExposureMode(QCamera::ExposureMode mode) } /*! + \qmlmethod bool QtMultimedia::Camera::isTorchModeSupported(ExposureMode mode) + Returns true if the exposure \a mode is supported. */ +/*! + Returns true if the exposure \a mode is supported. +*/ bool QCamera::isExposureModeSupported(QCamera::ExposureMode mode) const { Q_D(const QCamera); @@ -653,6 +961,15 @@ bool QCamera::isExposureModeSupported(QCamera::ExposureMode mode) const return d->control->isExposureModeSupported(mode); } +/*! + \qmlproperty QCamera::exposureCompensation + + Gets or sets the exposure compensation in EV units. + + Exposure compensation property allows to adjust the automatically calculated + exposure. +*/ + /*! \property QCamera::exposureCompensation \brief Exposure compensation in EV units. @@ -660,20 +977,30 @@ bool QCamera::isExposureModeSupported(QCamera::ExposureMode mode) const Exposure compensation property allows to adjust the automatically calculated exposure. */ - -qreal QCamera::exposureCompensation() const +float QCamera::exposureCompensation() const { Q_D(const QCamera); return d->control ? d->control->exposureCompensation() : 0.; } -void QCamera::setExposureCompensation(qreal ev) +void QCamera::setExposureCompensation(float ev) { Q_D(QCamera); if (d->control) d->control->setExposureCompensation(ev); } +/*! + \qmlproperty int QtMultimedia::Camera::isoSensitivity + + Describes the ISO sensitivity currently used by the camera. + +*/ + +/*! + \property int QCamera::manualIsoSensitivity + \brief Describes the ISO sensitivity currently used by the camera. +*/ int QCamera::isoSensitivity() const { Q_D(const QCamera); @@ -681,10 +1008,21 @@ int QCamera::isoSensitivity() const } /*! - \fn QCamera::setManualIsoSensitivity(int iso) - Sets the manual sensitivity to \a iso + \qmlproperty int QtMultimedia::Camera::manualIsoSensitivity + + Describes a manually set ISO sensitivity + + Setting this property to -1 (the default), implies that the camera + automatically adjusts the ISO sensitivity. */ +/*! + \property int QCamera::manualIsoSensitivity + \brief Describes a manually set ISO sensitivity + + Setting this property to -1 (the default), implies that the camera + automatically adjusts the ISO sensitivity. +*/ void QCamera::setManualIsoSensitivity(int iso) { Q_D(QCamera); @@ -712,12 +1050,18 @@ void QCamera::setAutoIsoSensitivity() d->control->setManualIsoSensitivity(-1); } +/*! + Returns the minimum ISO sensitivity supported by the camera. +*/ int QCamera::minimumIsoSensitivity() const { Q_D(const QCamera); return d->control ? d->control->minIso() : -1; } +/*! + Returns the maximum ISO sensitivity supported by the camera. +*/ int QCamera::maximumIsoSensitivity() const { Q_D(const QCamera); @@ -742,6 +1086,13 @@ float QCamera::maximumExposureTime() const return d->control ? d->control->maxExposureTime() : -1.; } +/*! + \qmlproperty float QtMultimedia::Camera::exposureTime + Returns the Camera's exposure time in seconds. + + \sa manualExposureTime +*/ + /*! \property QCamera::exposureTime \brief Camera's exposure time in seconds. @@ -772,6 +1123,15 @@ float QCamera::exposureTime() const return d->control ? d->control->exposureTime() : -1; } +/*! + \qmlproperty QtMultimedia::Camera::manualExposureTime + + Gets or sets a manual exposure time. + + Setting this property to -1 (the default) means that the camera + automatically determines the exposure time. +*/ + /*! Set the manual exposure time to \a seconds */ @@ -842,6 +1202,12 @@ void QCamera::setAutoExposureTime() \value ExposureBarcode Barcode mode. Since 5.5 */ +/*! + \qmlproperty QtMultimedia::Camera::flashReady + + Indicates if the flash is charged and ready to use. +*/ + /*! \property QCamera::flashReady \brief Indicates if the flash is charged and ready to use. @@ -860,17 +1226,21 @@ void QCamera::setAutoExposureTime() */ /*! - \fn void QCamera::exposureCompensationChanged(qreal value) + \fn void QCamera::exposureCompensationChanged(float value) Signal emitted when the exposure compensation changes to \a value. */ +/*! + \qmlproperty QtMultimedia::Camera::whiteBalanceMode + + Gets or sets the white balance mode being used. +*/ /*! Returns the white balance mode being used. */ - QCamera::WhiteBalanceMode QCamera::whiteBalanceMode() const { Q_D(const QCamera); @@ -880,7 +1250,6 @@ QCamera::WhiteBalanceMode QCamera::whiteBalanceMode() const /*! Sets the white balance to \a mode. */ - void QCamera::setWhiteBalanceMode(QCamera::WhiteBalanceMode mode) { Q_D(QCamera); @@ -894,9 +1263,14 @@ void QCamera::setWhiteBalanceMode(QCamera::WhiteBalanceMode mode) } /*! + \qmlmethod bool QtMultimedia::Camera::isWhiteBalanceModeSupported(WhiteBalanceMode mode) + Returns true if the white balance \a mode is supported. */ +/*! + Returns true if the white balance \a mode is supported. +*/ bool QCamera::isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const { Q_D(const QCamera); @@ -905,12 +1279,22 @@ bool QCamera::isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const return d->control->isWhiteBalanceModeSupported(mode); } +/*! + \qmlmethod QtMultimedia::Camera::colorTemperature + + Gets or sets the current color temperature. + + Setting a color temperature will only have an effect if WhiteBalanceManual is + supported. In this case, setting a temperature greater 0 will automatically set the + white balance mode to WhiteBalanceManual. Setting the temperature to 0 will reset + the white balance mode to WhiteBalanceAuto. +*/ + /*! Returns the current color temperature if the - current white balance mode is \c WhiteBalanceManual. For other modes the + current white balance mode is \c WhiteBalanceManual. For other modes the return value is undefined. */ - int QCamera::colorTemperature() const { Q_D(const QCamera); diff --git a/src/multimedia/camera/qcamera.h b/src/multimedia/camera/qcamera.h index 51e9d4e25..9bbbf453c 100644 --- a/src/multimedia/camera/qcamera.h +++ b/src/multimedia/camera/qcamera.h @@ -76,9 +76,11 @@ class Q_MULTIMEDIA_EXPORT QCamera : public QObject Q_PROPERTY(float minimumZoomFactor READ minimumZoomFactor NOTIFY minimumZoomFactorChanged) Q_PROPERTY(float maximumZoomFactor READ maximumZoomFactor NOTIFY maximumZoomFactorChanged) Q_PROPERTY(float zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) - Q_PROPERTY(qreal exposureTime READ exposureTime NOTIFY exposureTimeChanged) + Q_PROPERTY(float exposureTime READ exposureTime NOTIFY exposureTimeChanged) + Q_PROPERTY(int manualExposureTime READ manualExposureTime WRITE setManualExposureTime NOTIFY manualExposureTimeChanged) Q_PROPERTY(int isoSensitivity READ isoSensitivity NOTIFY isoSensitivityChanged) - Q_PROPERTY(qreal exposureCompensation READ exposureCompensation WRITE setExposureCompensation NOTIFY exposureCompensationChanged) + Q_PROPERTY(int manualIsoSensitivity READ manualIsoSensitivity WRITE setManualIsoSensitivity NOTIFY manualIsoSensitivityChanged) + Q_PROPERTY(float exposureCompensation READ exposureCompensation WRITE setExposureCompensation NOTIFY exposureCompensationChanged) Q_PROPERTY(QCamera::ExposureMode exposureMode READ exposureMode WRITE setExposureMode NOTIFY exposureModeChanged) Q_PROPERTY(bool flashReady READ isFlashReady NOTIFY flashReady) Q_PROPERTY(QCamera::FlashMode flashMode READ flashMode WRITE setFlashMode NOTIFY flashModeChanged) @@ -187,7 +189,7 @@ public: FocusMode focusMode() const; void setFocusMode(FocusMode mode); - bool isFocusModeSupported(FocusMode mode) const; + Q_INVOKABLE bool isFocusModeSupported(FocusMode mode) const; QPointF focusPoint() const; @@ -203,16 +205,16 @@ public: void setZoomFactor(float factor); FlashMode flashMode() const; - bool isFlashModeSupported(FlashMode mode) const; - bool isFlashReady() const; + Q_INVOKABLE bool isFlashModeSupported(FlashMode mode) const; + Q_INVOKABLE bool isFlashReady() const; TorchMode torchMode() const; - bool isTorchModeSupported(TorchMode mode) const; + Q_INVOKABLE bool isTorchModeSupported(TorchMode mode) const; ExposureMode exposureMode() const; - bool isExposureModeSupported(ExposureMode mode) const; + Q_INVOKABLE bool isExposureModeSupported(ExposureMode mode) const; - qreal exposureCompensation() const; + float exposureCompensation() const; int isoSensitivity() const; int manualIsoSensitivity() const; @@ -242,7 +244,7 @@ public Q_SLOTS: void setTorchMode(TorchMode mode); void setExposureMode(ExposureMode mode); - void setExposureCompensation(qreal ev); + void setExposureCompensation(float ev); void setManualIsoSensitivity(int iso); void setAutoIsoSensitivity(); @@ -273,8 +275,10 @@ Q_SIGNALS: void torchModeChanged(); void exposureTimeChanged(float speed); + void manualExposureTimeChanged(float speed); void isoSensitivityChanged(int); - void exposureCompensationChanged(qreal); + void manualIsoSensitivityChanged(int); + void exposureCompensationChanged(float); void exposureModeChanged(); void whiteBalanceModeChanged() const; diff --git a/src/multimedia/camera/qcameradevice.cpp b/src/multimedia/camera/qcameradevice.cpp index 47b5d1b95..8fa60dfa9 100644 --- a/src/multimedia/camera/qcameradevice.cpp +++ b/src/multimedia/camera/qcameradevice.cpp @@ -241,17 +241,16 @@ QString QCameraDevice::description() const /*! \enum QCameraDevice::Position - Describes the physical position of the camera on the hardware system. - - \value CameraDevice.UnspecifiedPosition - The physical positition of the camera is unspecified. - \value CameraDevice.FrontFace - The camera is on the front of the hardware, facing towards the user. - \value CameraDevice.BackFace - The camera is on the back of the hardware, facing away from the user. - \endtable -*/ + This enum specifies the physical position of the camera on the system hardware. + \value UnspecifiedPosition The camera position is unspecified or unknown. + \value BackFace The camera is on the back face of the system hardware. For example on a + mobile device, it means it is on the opposite side to that of the screen. + \value FrontFace The camera is on the front face of the system hardware. For example on a + mobile device, it means it is on the same side as that of the screen. + + \sa position() +*/ /*! \qmlmethod enumeration QtMultimedia::cameraDevice::position @@ -292,6 +291,12 @@ QList QCameraDevice::photoResolutions() const return d->photoResolutions; } +/*! + \qmlproperty CameraFormat QtMultiMedia::CameraDevice::videoFormats + + Holds the video formats supported by the camera. +*/ + /*! Returns the video formats supported by the camera. */ diff --git a/src/multimedia/camera/qcameradevice.h b/src/multimedia/camera/qcameradevice.h index d2a97d927..02dfdf6b5 100644 --- a/src/multimedia/camera/qcameradevice.h +++ b/src/multimedia/camera/qcameradevice.h @@ -79,6 +79,7 @@ class Q_MULTIMEDIA_EXPORT QCameraDevice Q_PROPERTY(QString description READ description CONSTANT) Q_PROPERTY(bool isDefault READ isDefault CONSTANT) Q_PROPERTY(Position position READ position CONSTANT) + Q_PROPERTY(QList videoFormats READ videoFormats CONSTANT) public: QCameraDevice(); QCameraDevice(const QCameraDevice& other); diff --git a/src/multimediaquick/camerafocus.qdoc b/src/multimediaquick/camerafocus.qdoc deleted file mode 100644 index 5fce6b645..000000000 --- a/src/multimediaquick/camerafocus.qdoc +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -QT_BEGIN_NAMESPACE - -/*! - \qmltype Camera - \instantiates QCamera - \inqmlmodule QtMultimedia - \brief An interface for camera settings related to focus and zoom. - \ingroup multimedia_qml - \ingroup camera_qml - - This type allows control over manual and automatic - focus settings, including information about any parts of the - camera frame that are selected for auto focusing. - - It should not be constructed separately, instead the - \c focus property of a \l Camera should be used. - - \qml - - Item { - width: 640 - height: 360 - - CaptureSession { - camera: Camera { - id: camera - - focusMode: Camera.FocusModeAutoNear - customFocusPoint: Qt.point(0.2, 0.2) // Focus relative to top-left corner - } - videoOutput: videoOutput - } - - VideoOutput { - id: videoOutput - anchors.fill: parent - } - } - - \endqml -*/ - -/*! - \qmlproperty enumeration CameraFocus::focusMode - - This property holds the current camera focus mode. - - \note In automatic focusing modes, the \l focusPoint property provides - information and control over the area of the image that is being focused. - - \value FocusModeAuto Continuous auto focus mode. - \value FocusModeAutoNear Continuous auto focus, preferring objects near to - the camera. - \value FocusModeAutoFar Continuous auto focus, preferring objects far away - from the camera. - \value FocusModeHyperfocal Focus to hyperfocal distance, with the maximum - depth of field achieved. All objects at distances from half of this - distance out to infinity will be acceptably sharp. - \value FocusModeInfinity Focus strictly to infinity. - \value FocusModeManual Manual or fixed focus mode. -*/ - -/*! - \qmlproperty list CameraFocus::supportedFocusMode - - This property holds the supported focus modes of the camera. - - \since 5.11 - \sa focusMode -*/ - -/*! - \qmlproperty point QtMultimedia::CameraFocus::customFocusPoint - - This property holds the position of custom focus point, in relative frame - coordinates. This means that QPointF(0,0) points to the top-left corner - of the frame, and QPointF(0.5,0.5) points to the center of the frame. - - Custom focus point is used only in \c FocusPointCustom focus mode. -*/ - -/*! - \qmlproperty real QtMultimedia::CameraFocus::minimumZoomFactor - - This property holds the minimum zoom factor supported. -*/ - -/*! - \qmlproperty real QtMultimedia::CameraFocus::maximumZoomFactor - - This property holds the maximum zoom factor supported, or \c 1.0 if zooming - is not supported. -*/ - -- cgit v1.2.3