问题
According to the documentation, QCameraInfo::availableCameras
should return list of available cameras. There's no catch to it according to the docs.
But still, I have two webcams and the array of available cameras is returned empty. What can I do? Is this even in the scope of programming, or does this mean Qt only supports limited subset of webcams?
The OS I'm using right now is Windows 7x64.
回答1:
I have this Problem too.Then I read about the example. I found that once you have declared QCamera object.it will return the right info. Like this :`
QCamera *cam = new QCamera;
qDebug()<<QCameraInfo::availableCameras().count();`
I have one camera,so it returns 1 at last;
回答2:
Try to copy the mediaservice
plugin folder into your application dir (where the exe
resides).
At least that solved this specific problem for me.
回答3:
You need to resolve your dependencies (like Thomas D. mentioned). (take a look at http://doc.qt.io/qt-5/windows-deployment.html )
From yourpathof\Qt\...subdir...\bin
execute
windeployqt.exe --debug YOURPATH\Debug
or
windeployqt.exe YOURPATH\Debug
来源:https://stackoverflow.com/questions/42567750/i-have-two-webcams-but-qcamerainfoavailablecameras-returns-empty-array