June 2019
Intermediate to advanced
348 pages
8h 28m
English
By using the QCameraInfo class from the Qt library, we can easily obtain the available cameras on the current computer. It has a static method named availableCameras that returns a list of QCameraInfo objects.
Now, we are going to add a slot for cameraInfoAction to do this work. First, we declare a private slot in the body of the MainWindow class in the mainwindow.h file:
private slots: void showCameraInfo();
Then, we give its implementation, as follows:
void MainWindow::showCameraInfo() { QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); QString info = QString("Available Cameras: \n"); foreach (const QCameraInfo &cameraInfo, cameras) { info += " - " + cameraInfo.deviceName() + ": "; info += cameraInfo.description() ...Read now
Unlock full access