Exemplo n.º 1
0
void QAndroidCameraFocusControl::onViewportSizeChanged()
{
    QCameraFocusZone::FocusZoneStatus status = QCameraFocusZone::Selected;
    if (!m_focusZones.isEmpty())
        status = m_focusZones.at(0).status();
    updateFocusZones(status);
}
void QAndroidCameraFocusControl::setCustomFocusPoint(const QPointF &point)
{
    if (m_customFocusPoint != point) {
        m_customFocusPoint = point;
        emit customFocusPointChanged(m_customFocusPoint);
    }

    if (m_session->camera() && m_focusPointMode == QCameraFocus::FocusPointCustom) {
        m_actualFocusPoint = m_customFocusPoint;
        updateFocusZones();
        setCameraFocusArea();
    }
}
Exemplo n.º 3
0
void QAndroidCameraFocusControl::setFocusPointMode(QCameraFocus::FocusPointMode mode)
{
    if (!m_session->camera() || m_focusPointMode == mode || !isFocusPointModeSupported(mode))
        return;

    m_focusPointMode = mode;

    if (mode == QCameraFocus::FocusPointCustom) {
        m_actualFocusPoint = m_customFocusPoint;
    } else {
        // FocusPointAuto | FocusPointCenter
        // note: there is no way to know the actual focus point in FocusPointAuto mode,
        // so just report the focus point to be at the center of the frame
        m_actualFocusPoint = QPointF(0.5, 0.5);
    }

    updateFocusZones();
    setCameraFocusArea();

    emit focusPointModeChanged(mode);
}
void QAndroidCameraFocusControl::onAutoFocusComplete(bool success)
{
    if (success)
        updateFocusZones(QCameraFocusZone::Focused);
}
void QAndroidCameraFocusControl::onAutoFocusStarted()
{
    updateFocusZones(QCameraFocusZone::Selected);
}
Exemplo n.º 6
0
QT_BEGIN_NAMESPACE

/*!
    \qmltype CameraFocus
    \instantiates QDeclarativeCameraFocus
    \inqmlmodule QtMultimedia
    \brief An interface for focus related camera settings.
    \ingroup multimedia_qml
    \ingroup camera_qml

    CameraFocus is part of the \b{QtMultimedia 5.0} module.

    This type allows control over manual and automatic
    focus settings, including information about any parts of the
    camera frame that are selected for autofocusing.

    It should not be constructed separately, instead the
    \c focus property of a \l Camera should be used.

    \qml
    import QtQuick 2.0
    import QtMultimedia 5.0

    Item {
        width: 640
        height: 360

        Camera {
            id: camera

            focus {
                focusMode: Camera.FocusMacro
                focusPointMode: Camera.FocusPointCustom
                customFocusPoint: Qt.point(0.2, 0.2) // Focus relative to top-left corner
            }
        }

        VideoOutput {
            source: camera
            anchors.fill: parent
        }
    }

    \endqml
*/

/*!
    \class QDeclarativeCameraFocus
    \internal
    \brief An interface for focus related camera settings.
*/

/*!
    Construct a declarative camera focus object using \a parent object.
 */

QDeclarativeCameraFocus::QDeclarativeCameraFocus(QCamera *camera, QObject *parent) :
    QObject(parent)
{
    m_focus = camera->focus();
    m_focusZones = new FocusZonesModel(this);

    updateFocusZones();

    connect(m_focus, SIGNAL(focusZonesChanged()), SLOT(updateFocusZones()));
}