After we have learned how to capture a still image from our camera, let's proceed to learn how to record videos as well. First, open mainwindow.h and add the following variables:
private: Ui::MainWindow *ui; QCamera* camera; QCameraViewfinder* viewfinder; QCameraImageCapture* imageCapture; QMediaRecorder* recorder; bool connected; bool recording;
Next, open mainwindow.ui again and right-click on the Record button. Choose Go to slot... from the menu and select the clicked() option, then, click the OK button. A slot function will be created for you; then proceed to add the following code into the slot function:
void MainWindow::on_recordButton_clicked() { if (connected) { if (!recording) { recorder = new QMediaRecorder(camera); camera->setCaptureMode...