QCameraInfo::availableCameras() does not respect user's privacy settings on Windows 10
Unsolved
General and Desktop
-
Hi,
On Windows 10, if you go to Settings -> Privacy -> Camera and switch off 'Allow apps to access your camera', QCameraInfo::availableCameras() still returns the camera (in my case, it returns 1).I used QtCreator and created sample Qt Widgets Application, then modified main.cpp to be:
#include "mainwindow.h" #include <QApplication> #include <QtMultimedia/QCameraInfo> int main(int argc, char *argv[]) { QApplication a(argc, argv); QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); qInfo() << "Length is " << cameras.length(); QCamera* camera = new QCamera(cameras.first()); qInfo() << "status : " << camera->status(); MainWindow w; w.show(); return a.exec(); }
I also added 'multimedia' to 'QT' in .pro file:
QT += core gui multimedia
The output produced by the application is as follows:
Length is 1 status : QCamera::UnloadedStatus
I would rather expect it to be 0 or 'QCamera::UnavailableStatus'.
Is there a way to detect that user has disabled access to camera?
I am using Qt 5.11.1.
-
Hi and welcome to devnet,
Qt uses native system call for that task so it returns whatever Windows wants to communicate about the hardware.
However listing and accessing are likely two different independent aspects.