Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Ios camera flash

Ios camera flash

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
9 Posts 5 Posters 2.3k Views 2 Watching
  • 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.
  • S Offline
    S Offline
    sashapont
    wrote on last edited by
    #1

    Is it possible to on/off camera flash?

    jsulmJ 1 Reply Last reply
    0
    • S sashapont

      Is it possible to on/off camera flash?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @sashapont It's all in the documentation: http://doc.qt.io/qt-5/qcameraflashcontrol.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sashapont
        wrote on last edited by sierdzio
        #3

        I can clearly understand this doc...

        I try this solution, but it is not work. Where is error?

        auto* camera = new QCamera(QCamera::BackFace);
             QObject::connect(camera, &QCamera::stateChanged, [=](QCamera::State state){
                qDebug() << "state:" << state;
                if (state == QCamera::LoadedState) {
                  auto *exposure = camera->exposure();
                  qDebug() << "FlashTorch: " << exposure->isFlashModeSupported(QCameraExposure::FlashTorch);
                  qDebug() << "FlashOn: " << exposure->isFlashModeSupported(QCameraExposure::FlashOn);
                  if (exposure->isFlashModeSupported(QCameraExposure::FlashTorch)) {
                    exposure->setFlashMode(QCameraExposure::FlashTorch);
                  } else if (exposure->isFlashModeSupported(QCameraExposure::FlashOn)){
                    exposure->setFlashMode(QCameraExposure::FlashOn);
                  }
                  qDebug() << "flashMode:" << exposure->flashMode();
                }
              });
              camera->load();
        

        (sierdzio) Edit: added missing code tags

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mvuori
          wrote on last edited by
          #4

          The first error is this: You show code, but don't tell where it fails & how it behaves. Does the camera work without flash? Does stateChanged() fire? What is the dDebug() output?

          Don't leave others guessing. The more information you give, the better. Others should not be expected do the basic debugging of your code for you.

          S 1 Reply Last reply
          1
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            Please also use code tags, it makes posts much more readable. I've already edited your post and added them here.

            (Z(:^

            1 Reply Last reply
            0
            • M mvuori

              The first error is this: You show code, but don't tell where it fails & how it behaves. Does the camera work without flash? Does stateChanged() fire? What is the dDebug() output?

              Don't leave others guessing. The more information you give, the better. Others should not be expected do the basic debugging of your code for you.

              S Offline
              S Offline
              sashapont
              wrote on last edited by
              #6

              @mvuori said in Ios camera flash:

              The first error is this: You show code, but don't tell where it fails & how it behaves. Does the camera work without flash? Does stateChanged() fire? What is the dDebug() output?

              Don't leave others guessing. The more information you give, the better. Others should not be expected do the basic debugging of your code for you.

              It is not fails, but the flash is not on
              In debug I have

              state: QCamera::LoadedState
              FlashTorch:  false
              FlashOn:  false
              flashMode: QFlags(0x2)
              
              jsulmJ 1 Reply Last reply
              0
              • S sashapont

                @mvuori said in Ios camera flash:

                The first error is this: You show code, but don't tell where it fails & how it behaves. Does the camera work without flash? Does stateChanged() fire? What is the dDebug() output?

                Don't leave others guessing. The more information you give, the better. Others should not be expected do the basic debugging of your code for you.

                It is not fails, but the flash is not on
                In debug I have

                state: QCamera::LoadedState
                FlashTorch:  false
                FlashOn:  false
                flashMode: QFlags(0x2)
                
                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @sashapont Looks like the flash modes you want to use are not supported. Could be that they are not implemented in Qt on iOS.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                  Hi,

                  From a quick look at the sources, the flash is supported since 5.8. Which version of Qt are you using ?

                  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
                  0
                  • S Offline
                    S Offline
                    sashapont
                    wrote on last edited by
                    #9

                    @SGaist said in Ios camera flash:

                    From a quick look at the sources, the flash is supported since 5.8. Which version of Qt are you using ?

                    5.9.1

                    1 Reply Last reply
                    0

                    • Login

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