Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Camera Status Issue
Forum Update on Monday, May 27th 2025

QML Camera Status Issue

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 285 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.
  • D Offline
    D Offline
    dboostudio
    wrote on 15 Oct 2020, 08:09 last edited by
    #1

    Hi,

    I'm using Qt 5.13.2 version.

    I want to check cameraStatus for my mac desktop app to notice that camera really work or not(depends on permission).
    I use QML Camera component for my app.

    Camera is not webcam, it's built-in camera on Laptop

    I checked cameraStatus work with Window OS.
    But, in macOS, cameraStatus value shows no diffrence while I turning on/off permission of camera for Qt Creator and MyApp.

    Also, I checked camera.availibilty , camera.cameraState

    Here is my Code for check camera-status

            onCameraStatusChanged: {
                console.log("camera-Status " + cameraStatus)
                // Camera Status
                // 0 : UnavailableStatus , 1: UnloadedStatus, 2: LoadingStatus, 3: UnloadingStatus, 4: LoadedStatus
                // 5: StandbyStatus, 6: StartingStatus, 7: StoppingStatus, 8: ActiveStatus
                if(App.windows){
                    if(cameraStatus < 4){
                        cameraConnection = false
                    } else if (cameraStatus >= 4){
                        cameraConnection = true
                    }
                    pageMain.selectImageCamera(cameraConnection)
                }
    
    
                if(!pageMain.watch && !snapShotDone && cameraStatus === 8){
                    console.log("camera-try to capture sanpshot")
                    capture()
                }
            }
    
            onCameraStateChanged: {
                console.log("dboo : camera-state changed to : " + cameraState)
    
                console.log("dboo : camera-availibility" + camera.availability)
                console.log("dboo : camera-   aviliable = " + Camera.Available)
                console.log("dboo : camera-   busy = " + Camera.Busy)
                console.log("dboo : camera-   Unavailable = " + Camera.Unavailable)
                console.log("dboo : camera-   ResourceMissing = " + Camera.ResourceMissing)
                if(App.macosx) {
                    switch(cameraState){
                    case 1:
                        pageMain.selectImageCamera(false)
                        break
                    case 2:
                        break
                    case 3:
                        pageMain.selectImageCamera(true)
                    }
                }
            }
    

    Here is Log, whether camera-permission on/off, log shows same.

    qml: camera-Status 4
    qml: camera-Status 6
    qml: dboo : camera-state changed to : 2
    qml: dboo : camera-availibility0
    qml: dboo : camera-   aviliable = 0
    qml: dboo : camera-   busy = 2
    qml: dboo : camera-   Unavailable = 1
    qml: dboo : camera-   ResourceMissing = 3
    qml: camera-Status 8
    qml: camera-Status 7
    qml: dboo : camera-state changed to : 1
    qml: dboo : camera-availibility0
    qml: dboo : camera-   aviliable = 0
    qml: dboo : camera-   busy = 2
    qml: dboo : camera-   Unavailable = 1
    qml: dboo : camera-   ResourceMissing = 3
    

    Is there another way to check camera availibilty on macOS?
    Or, Is there right way to check macOS availibilty with above code?

    1 Reply Last reply
    0

    1/1

    15 Oct 2020, 08:09

    • Login

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