Controlling the camera

The QCameraFocus class is mentioned to control the zoom and focus of the camera. Speaking of zoom, Qt supports both optical and digital zoom. As we all know, optical zoom offers a better quality than digital. Hence, optical zoom should take priority over digital.

Drag a horizontal slider and a label to MainWindow pane's verticalLayout just above the capture button. Name them zoomSlider and zoomLabel, respectively. Remember to change the text of zoomLabel to Zoom and Horizontal in alignment to AlignHCenter. Since Qt doesn't provide a floating point number slider, we simply multiply 10 to get an integer in the slider. Hence, change the minimum value of zoomSlider to 10, which means zoom by 1.0.

Include QCameraFocus in mainwindow.h ...

Get Qt 5 Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.