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
zoomLabel, respectively. Remember to change the text of
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
10, which means zoom by 1.0.