Hello,
I'd like to write a library that uses Qt's capabilites to control cameras. The lib is to be used in both console and gui applications. However, a QApplication object seems to be necessary for QCameraInfo to work properly. Why is this the case? Is it possible to use QCameraInfo and QCamera without a graphical user interace? Consider the following example. If no QApplication is constructed, QCameraInfo::availableCameras() always returns an empty list:
#include <iostream>
#include <QtMultimedia/QCamera>
#include <QtMultimedia/QCameraInfo>
#include <QApplication>
using namespace std;
int main(int argn, char** argv)
{
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
cout << cameras.size() << endl;
return 0;
}
#include <iostream>
#include <QtMultimedia/QCamera>
#include <QtMultimedia/QCameraInfo>
#include <QApplication>
using namespace std;
int main(int argn, char** argv)
{
QApplication app(argn, argv);
QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
cout << cameras.size() << endl;
return 0;
}
To copy to clipboard, switch view to plain text mode
I'm using windows 10 and Qt 5.5.1. Thank you for your help!
Bookmarks