Android: fix setting camera parameters from QML.
We were ignoring new parameter values when the camera was not loaded. All QML properties that were set at initialization time were therefore ignored since the camera is not loaded at that point. We now store all camera parameters and apply them once the camera is loaded. Task-number: QTBUG-39307 Change-Id: If66d768941c25cede2aea1b48fb928c4735c10f8 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
@@ -63,6 +63,9 @@ QAndroidCameraExposureControl::QAndroidCameraExposureControl(QAndroidCameraSessi
|
||||
|
||||
bool QAndroidCameraExposureControl::isParameterSupported(ExposureParameter parameter) const
|
||||
{
|
||||
if (!m_session->camera())
|
||||
return false;
|
||||
|
||||
switch (parameter) {
|
||||
case QCameraExposureControl::ISO:
|
||||
return false;
|
||||
@@ -71,7 +74,7 @@ bool QAndroidCameraExposureControl::isParameterSupported(ExposureParameter param
|
||||
case QCameraExposureControl::ShutterSpeed:
|
||||
return false;
|
||||
case QCameraExposureControl::ExposureCompensation:
|
||||
return true;
|
||||
return !m_supportedExposureCompensations.isEmpty();
|
||||
case QCameraExposureControl::FlashPower:
|
||||
return false;
|
||||
case QCameraExposureControl::FlashCompensation:
|
||||
@@ -81,7 +84,7 @@ bool QAndroidCameraExposureControl::isParameterSupported(ExposureParameter param
|
||||
case QCameraExposureControl::SpotMeteringPoint:
|
||||
return false;
|
||||
case QCameraExposureControl::ExposureMode:
|
||||
return true;
|
||||
return !m_supportedExposureModes.isEmpty();
|
||||
case QCameraExposureControl::MeteringMode:
|
||||
return false;
|
||||
default:
|
||||
@@ -127,27 +130,41 @@ QVariant QAndroidCameraExposureControl::actualValue(ExposureParameter parameter)
|
||||
|
||||
bool QAndroidCameraExposureControl::setValue(ExposureParameter parameter, const QVariant& value)
|
||||
{
|
||||
if (!m_session->camera() || !value.isValid())
|
||||
if (!value.isValid())
|
||||
return false;
|
||||
|
||||
if (parameter == QCameraExposureControl::ExposureCompensation) {
|
||||
m_requestedExposureCompensation = value.toReal();
|
||||
qreal expComp = value.toReal();
|
||||
if (!qFuzzyCompare(m_requestedExposureCompensation, expComp)) {
|
||||
m_requestedExposureCompensation = expComp;
|
||||
emit requestedValueChanged(QCameraExposureControl::ExposureCompensation);
|
||||
}
|
||||
|
||||
if (!m_session->camera())
|
||||
return true;
|
||||
|
||||
int expCompIndex = qRound(m_requestedExposureCompensation / m_exposureCompensationStep);
|
||||
if (expCompIndex >= m_minExposureCompensationIndex
|
||||
&& expCompIndex <= m_maxExposureCompensationIndex) {
|
||||
qreal comp = expCompIndex * m_exposureCompensationStep;
|
||||
m_session->camera()->setExposureCompensation(expCompIndex);
|
||||
|
||||
if (!qFuzzyCompare(m_actualExposureCompensation, comp)) {
|
||||
m_actualExposureCompensation = expCompIndex * m_exposureCompensationStep;
|
||||
emit actualValueChanged(QCameraExposureControl::ExposureCompensation);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (parameter == QCameraExposureControl::ExposureMode) {
|
||||
m_requestedExposureMode = value.value<QCameraExposure::ExposureMode>();
|
||||
QCameraExposure::ExposureMode expMode = value.value<QCameraExposure::ExposureMode>();
|
||||
if (m_requestedExposureMode != expMode) {
|
||||
m_requestedExposureMode = expMode;
|
||||
emit requestedValueChanged(QCameraExposureControl::ExposureMode);
|
||||
}
|
||||
|
||||
if (!m_session->camera())
|
||||
return true;
|
||||
|
||||
if (!m_supportedExposureModes.isEmpty()) {
|
||||
m_actualExposureMode = m_requestedExposureMode;
|
||||
@@ -190,22 +207,19 @@ bool QAndroidCameraExposureControl::setValue(ExposureParameter parameter, const
|
||||
|
||||
void QAndroidCameraExposureControl::onCameraOpened()
|
||||
{
|
||||
m_requestedExposureCompensation = m_actualExposureCompensation = 0.0;
|
||||
m_requestedExposureMode = m_actualExposureMode = QCameraExposure::ExposureAuto;
|
||||
emit requestedValueChanged(QCameraExposureControl::ExposureCompensation);
|
||||
emit actualValueChanged(QCameraExposureControl::ExposureCompensation);
|
||||
emit requestedValueChanged(QCameraExposureControl::ExposureMode);
|
||||
emit actualValueChanged(QCameraExposureControl::ExposureMode);
|
||||
|
||||
m_supportedExposureCompensations.clear();
|
||||
m_minExposureCompensationIndex = m_session->camera()->getMinExposureCompensation();
|
||||
m_maxExposureCompensationIndex = m_session->camera()->getMaxExposureCompensation();
|
||||
m_exposureCompensationStep = m_session->camera()->getExposureCompensationStep();
|
||||
if (m_minExposureCompensationIndex != 0 || m_maxExposureCompensationIndex != 0) {
|
||||
for (int i = m_minExposureCompensationIndex; i <= m_maxExposureCompensationIndex; ++i)
|
||||
m_supportedExposureCompensations.append(i * m_exposureCompensationStep);
|
||||
emit parameterRangeChanged(QCameraExposureControl::ExposureCompensation);
|
||||
}
|
||||
|
||||
m_supportedExposureModes.clear();
|
||||
QStringList sceneModes = m_session->camera()->getSupportedSceneModes();
|
||||
if (!sceneModes.isEmpty()) {
|
||||
for (int i = 0; i < sceneModes.size(); ++i) {
|
||||
const QString &sceneMode = sceneModes.at(i);
|
||||
if (sceneMode == QLatin1String("auto"))
|
||||
@@ -222,6 +236,10 @@ void QAndroidCameraExposureControl::onCameraOpened()
|
||||
m_supportedExposureModes << QVariant::fromValue(QCameraExposure::ExposureSports);
|
||||
}
|
||||
emit parameterRangeChanged(QCameraExposureControl::ExposureMode);
|
||||
}
|
||||
|
||||
setValue(QCameraExposureControl::ExposureCompensation, QVariant::fromValue(m_requestedExposureCompensation));
|
||||
setValue(QCameraExposureControl::ExposureMode, QVariant::fromValue(m_requestedExposureMode));
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -62,7 +62,12 @@ QCameraExposure::FlashModes QAndroidCameraFlashControl::flashMode() const
|
||||
|
||||
void QAndroidCameraFlashControl::setFlashMode(QCameraExposure::FlashModes mode)
|
||||
{
|
||||
if (m_flashMode == mode || !m_session->camera() || !isFlashModeSupported(mode))
|
||||
if (!m_session->camera()) {
|
||||
m_flashMode = mode;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isFlashModeSupported(mode))
|
||||
return;
|
||||
|
||||
// if torch was enabled, it first needs to be turned off before setting another mode
|
||||
@@ -88,7 +93,7 @@ void QAndroidCameraFlashControl::setFlashMode(QCameraExposure::FlashModes mode)
|
||||
|
||||
bool QAndroidCameraFlashControl::isFlashModeSupported(QCameraExposure::FlashModes mode) const
|
||||
{
|
||||
return m_supportedFlashModes.contains(mode);
|
||||
return m_session->camera() ? m_supportedFlashModes.contains(mode) : false;
|
||||
}
|
||||
|
||||
bool QAndroidCameraFlashControl::isFlashReady() const
|
||||
@@ -115,6 +120,11 @@ void QAndroidCameraFlashControl::onCameraOpened()
|
||||
else if (flashMode == QLatin1String("torch"))
|
||||
m_supportedFlashModes << QCameraExposure::FlashVideoLight;
|
||||
}
|
||||
|
||||
if (!m_supportedFlashModes.contains(m_flashMode))
|
||||
m_flashMode = QCameraExposure::FlashOff;
|
||||
|
||||
setFlashMode(m_flashMode);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -80,9 +80,12 @@ QCameraFocus::FocusModes QAndroidCameraFocusControl::focusMode() const
|
||||
|
||||
void QAndroidCameraFocusControl::setFocusMode(QCameraFocus::FocusModes mode)
|
||||
{
|
||||
if (m_focusMode == mode || !m_session->camera() || !isFocusModeSupported(mode))
|
||||
if (!m_session->camera()) {
|
||||
setFocusModeHelper(mode);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isFocusModeSupported(mode)) {
|
||||
QString focusMode = QLatin1String("fixed");
|
||||
|
||||
if (mode.testFlag(QCameraFocus::HyperfocalFocus)) {
|
||||
@@ -109,13 +112,13 @@ void QAndroidCameraFocusControl::setFocusMode(QCameraFocus::FocusModes mode)
|
||||
// reset focus position
|
||||
m_session->camera()->cancelAutoFocus();
|
||||
|
||||
m_focusMode = mode;
|
||||
emit focusModeChanged(m_focusMode);
|
||||
setFocusModeHelper(mode);
|
||||
}
|
||||
}
|
||||
|
||||
bool QAndroidCameraFocusControl::isFocusModeSupported(QCameraFocus::FocusModes mode) const
|
||||
{
|
||||
return m_supportedFocusModes.contains(mode);
|
||||
return m_session->camera() ? m_supportedFocusModes.contains(mode) : false;
|
||||
}
|
||||
|
||||
QCameraFocus::FocusPointMode QAndroidCameraFocusControl::focusPointMode() const
|
||||
@@ -125,11 +128,12 @@ QCameraFocus::FocusPointMode QAndroidCameraFocusControl::focusPointMode() const
|
||||
|
||||
void QAndroidCameraFocusControl::setFocusPointMode(QCameraFocus::FocusPointMode mode)
|
||||
{
|
||||
if (!m_session->camera() || m_focusPointMode == mode || !isFocusPointModeSupported(mode))
|
||||
if (!m_session->camera()) {
|
||||
setFocusPointModeHelper(mode);
|
||||
return;
|
||||
}
|
||||
|
||||
m_focusPointMode = mode;
|
||||
|
||||
if (isFocusPointModeSupported(mode)) {
|
||||
if (mode == QCameraFocus::FocusPointCustom) {
|
||||
m_actualFocusPoint = m_customFocusPoint;
|
||||
} else {
|
||||
@@ -139,15 +143,16 @@ void QAndroidCameraFocusControl::setFocusPointMode(QCameraFocus::FocusPointMode
|
||||
m_actualFocusPoint = QPointF(0.5, 0.5);
|
||||
}
|
||||
|
||||
setFocusPointModeHelper(mode);
|
||||
|
||||
updateFocusZones();
|
||||
setCameraFocusArea();
|
||||
|
||||
emit focusPointModeChanged(mode);
|
||||
}
|
||||
}
|
||||
|
||||
bool QAndroidCameraFocusControl::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const
|
||||
{
|
||||
return m_supportedFocusPointModes.contains(mode);
|
||||
return m_session->camera() ? m_supportedFocusPointModes.contains(mode) : false;
|
||||
}
|
||||
|
||||
QPointF QAndroidCameraFocusControl::customFocusPoint() const
|
||||
@@ -157,13 +162,12 @@ QPointF QAndroidCameraFocusControl::customFocusPoint() const
|
||||
|
||||
void QAndroidCameraFocusControl::setCustomFocusPoint(const QPointF &point)
|
||||
{
|
||||
if (m_customFocusPoint == point)
|
||||
return;
|
||||
|
||||
if (m_customFocusPoint != point) {
|
||||
m_customFocusPoint = point;
|
||||
emit customFocusPointChanged(m_customFocusPoint);
|
||||
}
|
||||
|
||||
if (m_focusPointMode == QCameraFocus::FocusPointCustom) {
|
||||
if (m_session->camera() && m_focusPointMode == QCameraFocus::FocusPointCustom) {
|
||||
m_actualFocusPoint = m_customFocusPoint;
|
||||
updateFocusZones();
|
||||
setCameraFocusArea();
|
||||
@@ -187,12 +191,7 @@ void QAndroidCameraFocusControl::onCameraOpened()
|
||||
m_supportedFocusModes.clear();
|
||||
m_continuousPictureFocusSupported = false;
|
||||
m_continuousVideoFocusSupported = false;
|
||||
|
||||
m_focusPointMode = QCameraFocus::FocusPointAuto;
|
||||
m_actualFocusPoint = QPointF(0.5, 0.5);
|
||||
m_customFocusPoint = QPointF();
|
||||
m_supportedFocusPointModes.clear();
|
||||
m_focusZones.clear();
|
||||
|
||||
QStringList focusModes = m_session->camera()->getSupportedFocusModes();
|
||||
for (int i = 0; i < focusModes.size(); ++i) {
|
||||
@@ -220,10 +219,14 @@ void QAndroidCameraFocusControl::onCameraOpened()
|
||||
if (m_session->camera()->getMaxNumFocusAreas() > 0)
|
||||
m_supportedFocusPointModes << QCameraFocus::FocusPointCenter << QCameraFocus::FocusPointCustom;
|
||||
|
||||
emit focusModeChanged(focusMode());
|
||||
emit focusPointModeChanged(m_focusPointMode);
|
||||
emit customFocusPointChanged(m_customFocusPoint);
|
||||
emit focusZonesChanged();
|
||||
if (!m_supportedFocusModes.contains(m_focusMode))
|
||||
setFocusModeHelper(QCameraFocus::AutoFocus);
|
||||
if (!m_supportedFocusPointModes.contains(m_focusPointMode))
|
||||
setFocusPointModeHelper(QCameraFocus::FocusPointAuto);
|
||||
|
||||
setFocusMode(m_focusMode);
|
||||
setCustomFocusPoint(m_customFocusPoint);
|
||||
setFocusPointMode(m_focusPointMode);
|
||||
}
|
||||
|
||||
void QAndroidCameraFocusControl::updateFocusZones(QCameraFocusZone::FocusZoneStatus status)
|
||||
@@ -276,11 +279,12 @@ void QAndroidCameraFocusControl::onViewportSizeChanged()
|
||||
if (!m_focusZones.isEmpty())
|
||||
status = m_focusZones.at(0).status();
|
||||
updateFocusZones(status);
|
||||
setCameraFocusArea();
|
||||
}
|
||||
|
||||
void QAndroidCameraFocusControl::onCameraCaptureModeChanged()
|
||||
{
|
||||
if (m_focusMode == QCameraFocus::ContinuousFocus) {
|
||||
if (m_session->camera() && m_focusMode == QCameraFocus::ContinuousFocus) {
|
||||
QString focusMode;
|
||||
if ((m_session->captureMode().testFlag(QCamera::CaptureVideo) && m_continuousVideoFocusSupported)
|
||||
|| !m_continuousPictureFocusSupported) {
|
||||
|
||||
@@ -72,6 +72,22 @@ private Q_SLOTS:
|
||||
void onAutoFocusComplete(bool success);
|
||||
|
||||
private:
|
||||
inline void setFocusModeHelper(QCameraFocus::FocusModes mode)
|
||||
{
|
||||
if (m_focusMode != mode) {
|
||||
m_focusMode = mode;
|
||||
emit focusModeChanged(mode);
|
||||
}
|
||||
}
|
||||
|
||||
inline void setFocusPointModeHelper(QCameraFocus::FocusPointMode mode)
|
||||
{
|
||||
if (m_focusPointMode != mode) {
|
||||
m_focusPointMode = mode;
|
||||
emit focusPointModeChanged(mode);
|
||||
}
|
||||
}
|
||||
|
||||
void updateFocusZones(QCameraFocusZone::FocusZoneStatus status = QCameraFocusZone::Selected);
|
||||
void setCameraFocusArea();
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
|
||||
QAndroidCameraImageProcessingControl::QAndroidCameraImageProcessingControl(QAndroidCameraSession *session)
|
||||
: QCameraImageProcessingControl()
|
||||
, m_session(session)
|
||||
, m_whiteBalanceMode(QCameraImageProcessing::WhiteBalanceAuto)
|
||||
{
|
||||
connect(m_session, SIGNAL(opened()),
|
||||
this, SLOT(onCameraOpened()));
|
||||
@@ -56,19 +57,17 @@ QAndroidCameraImageProcessingControl::QAndroidCameraImageProcessingControl(QAndr
|
||||
|
||||
bool QAndroidCameraImageProcessingControl::isParameterSupported(ProcessingParameter parameter) const
|
||||
{
|
||||
return (parameter == QCameraImageProcessingControl::WhiteBalancePreset);
|
||||
return parameter == QCameraImageProcessingControl::WhiteBalancePreset
|
||||
&& m_session->camera()
|
||||
&& !m_supportedWhiteBalanceModes.isEmpty();
|
||||
}
|
||||
|
||||
bool QAndroidCameraImageProcessingControl::isParameterValueSupported(ProcessingParameter parameter,
|
||||
const QVariant &value) const
|
||||
{
|
||||
if (parameter != QCameraImageProcessingControl::WhiteBalancePreset)
|
||||
return false;
|
||||
|
||||
if (!m_session->camera())
|
||||
return false;
|
||||
|
||||
return m_supportedWhiteBalanceModes.contains(value.value<QCameraImageProcessing::WhiteBalanceMode>());
|
||||
return parameter == QCameraImageProcessingControl::WhiteBalancePreset
|
||||
&& m_session->camera()
|
||||
&& m_supportedWhiteBalanceModes.contains(value.value<QCameraImageProcessing::WhiteBalanceMode>());
|
||||
}
|
||||
|
||||
QVariant QAndroidCameraImageProcessingControl::parameter(ProcessingParameter parameter) const
|
||||
@@ -76,13 +75,7 @@ QVariant QAndroidCameraImageProcessingControl::parameter(ProcessingParameter par
|
||||
if (parameter != QCameraImageProcessingControl::WhiteBalancePreset)
|
||||
return QVariant();
|
||||
|
||||
if (!m_session->camera())
|
||||
return QVariant();
|
||||
|
||||
QString wb = m_session->camera()->getWhiteBalance();
|
||||
QCameraImageProcessing::WhiteBalanceMode mode = m_supportedWhiteBalanceModes.key(wb, QCameraImageProcessing::WhiteBalanceAuto);
|
||||
|
||||
return QVariant::fromValue(mode);
|
||||
return QVariant::fromValue(m_whiteBalanceMode);
|
||||
}
|
||||
|
||||
void QAndroidCameraImageProcessingControl::setParameter(ProcessingParameter parameter, const QVariant &value)
|
||||
@@ -90,12 +83,21 @@ void QAndroidCameraImageProcessingControl::setParameter(ProcessingParameter para
|
||||
if (parameter != QCameraImageProcessingControl::WhiteBalancePreset)
|
||||
return;
|
||||
|
||||
if (!m_session->camera())
|
||||
return;
|
||||
QCameraImageProcessing::WhiteBalanceMode mode = value.value<QCameraImageProcessing::WhiteBalanceMode>();
|
||||
|
||||
QString wb = m_supportedWhiteBalanceModes.value(value.value<QCameraImageProcessing::WhiteBalanceMode>(), QString());
|
||||
if (!wb.isEmpty())
|
||||
if (m_session->camera())
|
||||
setWhiteBalanceModeHelper(mode);
|
||||
else
|
||||
m_whiteBalanceMode = mode;
|
||||
}
|
||||
|
||||
void QAndroidCameraImageProcessingControl::setWhiteBalanceModeHelper(QCameraImageProcessing::WhiteBalanceMode mode)
|
||||
{
|
||||
QString wb = m_supportedWhiteBalanceModes.value(mode, QString());
|
||||
if (!wb.isEmpty()) {
|
||||
m_session->camera()->setWhiteBalance(wb);
|
||||
m_whiteBalanceMode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
void QAndroidCameraImageProcessingControl::onCameraOpened()
|
||||
@@ -130,6 +132,11 @@ void QAndroidCameraImageProcessingControl::onCameraOpened()
|
||||
QStringLiteral("warm-fluorescent"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_supportedWhiteBalanceModes.contains(m_whiteBalanceMode))
|
||||
m_whiteBalanceMode = QCameraImageProcessing::WhiteBalanceAuto;
|
||||
|
||||
setWhiteBalanceModeHelper(m_whiteBalanceMode);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -63,9 +63,13 @@ private Q_SLOTS:
|
||||
void onCameraOpened();
|
||||
|
||||
private:
|
||||
void setWhiteBalanceModeHelper(QCameraImageProcessing::WhiteBalanceMode mode);
|
||||
|
||||
QAndroidCameraSession *m_session;
|
||||
|
||||
QHash<QCameraImageProcessing::WhiteBalanceMode, QString> m_supportedWhiteBalanceModes;
|
||||
QCameraImageProcessing::WhiteBalanceMode m_whiteBalanceMode;
|
||||
|
||||
QMap<QCameraImageProcessing::WhiteBalanceMode, QString> m_supportedWhiteBalanceModes;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -66,13 +66,13 @@ QAndroidCameraLocksControl::QAndroidCameraLocksControl(QAndroidCameraSession *se
|
||||
|
||||
QCamera::LockTypes QAndroidCameraLocksControl::supportedLocks() const
|
||||
{
|
||||
return (QCamera::LockExposure | QCamera::LockWhiteBalance | QCamera::LockFocus);
|
||||
return m_supportedLocks;
|
||||
}
|
||||
|
||||
QCamera::LockStatus QAndroidCameraLocksControl::lockStatus(QCamera::LockType lock) const
|
||||
{
|
||||
if (!m_supportedLocks.testFlag(lock) || !m_session->camera())
|
||||
return QCamera::Locked;
|
||||
return QCamera::Unlocked;
|
||||
|
||||
if (lock == QCamera::LockFocus)
|
||||
return m_focusLockStatus;
|
||||
@@ -83,7 +83,7 @@ QCamera::LockStatus QAndroidCameraLocksControl::lockStatus(QCamera::LockType loc
|
||||
if (lock == QCamera::LockWhiteBalance)
|
||||
return m_whiteBalanceLockStatus;
|
||||
|
||||
return QCamera::Locked;
|
||||
return QCamera::Unlocked;
|
||||
}
|
||||
|
||||
void QAndroidCameraLocksControl::searchAndLock(QCamera::LockTypes locks)
|
||||
|
||||
@@ -96,15 +96,12 @@ void QAndroidCameraZoomControl::zoomTo(qreal optical, qreal digital)
|
||||
{
|
||||
Q_UNUSED(optical);
|
||||
|
||||
if (!m_cameraSession->camera() ||
|
||||
qFuzzyCompare(m_requestedZoom, digital) ||
|
||||
qFuzzyCompare(m_maximumZoom, qreal(1))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!qFuzzyCompare(m_requestedZoom, digital)) {
|
||||
m_requestedZoom = digital;
|
||||
emit requestedDigitalZoomChanged(m_requestedZoom);
|
||||
}
|
||||
|
||||
if (m_cameraSession->camera()) {
|
||||
digital = qBound(qreal(1), digital, m_maximumZoom);
|
||||
int validZoomIndex = qt_findClosestValue(m_zoomRatios, qRound(digital * 100));
|
||||
qreal newZoom = m_zoomRatios.at(validZoomIndex) / qreal(100);
|
||||
@@ -113,15 +110,11 @@ void QAndroidCameraZoomControl::zoomTo(qreal optical, qreal digital)
|
||||
m_currentZoom = newZoom;
|
||||
emit currentDigitalZoomChanged(m_currentZoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QAndroidCameraZoomControl::onCameraOpened()
|
||||
{
|
||||
m_requestedZoom = 1.0;
|
||||
m_currentZoom = 1.0;
|
||||
emit requestedDigitalZoomChanged(m_requestedZoom);
|
||||
emit currentDigitalZoomChanged(m_currentZoom);
|
||||
|
||||
if (m_cameraSession->camera()->isZoomSupported()) {
|
||||
m_zoomRatios = m_cameraSession->camera()->getZoomRatios();
|
||||
qreal maxZoom = m_zoomRatios.last() / qreal(100);
|
||||
@@ -129,6 +122,7 @@ void QAndroidCameraZoomControl::onCameraOpened()
|
||||
m_maximumZoom = maxZoom;
|
||||
emit maximumDigitalZoomChanged(m_maximumZoom);
|
||||
}
|
||||
zoomTo(1, m_requestedZoom);
|
||||
} else {
|
||||
m_zoomRatios.clear();
|
||||
if (!qFuzzyCompare(m_maximumZoom, qreal(1))) {
|
||||
|
||||
Reference in New Issue
Block a user