Book Image

Application Development with Qt Creator - Second Edition

Book Image

Application Development with Qt Creator - Second Edition

Overview of this book

Table of Contents (20 chapters)
Application Development with Qt Creator Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Accessing the camera


To access the camera when it is supported by the hardware and Qt Multimedia, use the Camera type and its associated types to control the camera's capture behavior, exposure, flash, focus, and image processing settings. A simple use of the camera to show a viewfinder looks like the following code:

import QtQuick 2.3
import QtMultimedia 5.0

Item {
    width: 640
    height: 480

    Camera {
        id: camera
    }

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

In short, the Camera type acts like a source for the video just as a MediaPlayer instance does.

The Camera type provides a few properties to control its behavior. They are:

  • imageCapture: This is an instance of CameraCapture, which defines how the camera should capture an image

  • videoRecording: This is an instance of CameraRecorder, which defines how the camera should capture a video

  • exposure: This is an instance of CameraExposure, which controls the various options for the exposure...