CameraFocus QML Type

An interface for focus related camera settings. More...

Import Statement: import QtMultimedia 5.7

Properties

Methods

Detailed Description

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 focus property of a Camera should be used.


  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
      }
  }

Property Documentation

customFocusPoint : point

This property holds the position of 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.

Custom focus point is used only in FocusPointCustom focus mode.


focusMode : enumeration

This property holds the current camera focus mode, which can be one of the following values:

ValueDescription
FocusManualManual or fixed focus mode.
FocusHyperfocalFocus 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.
FocusInfinityFocus strictly to infinity.
FocusAutoOne-shot auto focus mode.
FocusContinuousContinuous auto focus mode.
FocusMacroOne shot auto focus to objects close to camera.

It's possible to combine multiple Camera::FocusMode values, for example Camera.FocusMacro + Camera.FocusContinuous.

In automatic focusing modes, the focusPointMode property and focusZones property provide information and control over how automatic focusing is performed.


focusPointMode : enumeration

This property holds the current camera focus point mode. It is used in automatic focusing modes to determine what to focus on. If the current focus point mode is Camera.FocusPointCustom, the customFocusPoint property allows you to specify which part of the frame to focus on.

The property can take one of the following values:

ValueDescription
FocusPointAutoAutomatically select one or multiple focus points.
FocusPointCenterFocus to the frame center.
FocusPointFaceDetectionFocus on faces in the frame.
FocusPointCustomFocus to the custom point, defined by the customFocusPoint property.

focusZones : list<focusZone>

This property holds the list of current camera focus zones, each including area specified in the same coordinates as customFocusPoint, and zone status as one of the following values:

ValueDescription
Camera.FocusAreaUnusedThis focus point area is currently unused in autofocusing.
Camera.FocusAreaSelectedThis focus point area is used in autofocusing, but is not in focus.
Camera.FocusAreaFocusedThis focus point is used in autofocusing, and is in focus.

  VideoOutput {
      id: viewfinder
      source: camera

      //display focus areas on camera viewfinder:
      Repeater {
            model: camera.focus.focusZones

            Rectangle {
                border {
                    width: 2
                    color: status == Camera.FocusAreaFocused ? "green" : "white"
                }
                color: "transparent"

                // Map from the relative, normalized frame coordinates
                property variant mappedRect: viewfinder.mapNormalizedRectToItem(area);

                x: mappedRect.x
                y: mappedRect.y
                width: mappedRect.width
                height: mappedRect.height
            }
      }
  }


Method Documentation

bool isFocusModeSupported(mode) const

Returns true if the supplied mode is a supported focus mode, and false otherwise.


bool isFocusPointModeSupported(mode) const

Returns true if the supplied mode is a supported focus point mode, and false otherwise.