Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QCameraInfo::availableCameras() does not respect user's privacy settings on Windows 10
QtWS25 Last Chance

QCameraInfo::availableCameras() does not respect user's privacy settings on Windows 10

Scheduled Pinned Locked Moved Unsolved General and Desktop
qcamerainfoqcamerawindows 10
2 Posts 2 Posters 774 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manicaesar
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved