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. How to set the camera flash on

How to set the camera flash on

Scheduled Pinned Locked Moved Mobile and Embedded
18 Posts 8 Posters 11.8k Views 1 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.
  • A Offline
    A Offline
    alfah
    wrote on last edited by
    #1

    Hi everybody,

    Im working on the Qt Camera api. I've managed to open the viewfinder but cant set the flash on. Kindly help me on this one

    Thank you

    Alfah

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kkrzewniak
      wrote on last edited by
      #2

      Have a look at the QCameraExposure object thats assosiated with your QCamera instance. If you have some more questions feel free to ask.
      Hint: QCameraExposure::FlashModes
      Welcome to Devnet btw.

      Me, Grimlock, not "nice dino". ME BASH BRAINS!

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alfah
        wrote on last edited by
        #3

        Thank you kkrzewniak,

        The thing is, i couldn get how to use QcameraExposure::Flashmode.
        I found "QCameraExposure::FlashOn 0x4 Flash is On." in the docs but how do you use it? Could you gimme an example?.
        It is not a function right. Hope you don mind answering the basics. :)

        regards,
        alfah

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

          Hi,
          please look at this link

          "http://www.developer.nokia.com/Community/Discussion/showthread.php?226102-How-can-I-use-camera-flash-as-a-tourch&p=851607#post851607":http://www.developer.nokia.com/Community/Discussion/showthread.php?226102-How-can-I-use-camera-flash-as-a-tourch&p=851607#post851607

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alfah
            wrote on last edited by
            #5

            :)

            i did . . i does not give any solutions. . Theres gotta be some way to turn on the flash right??

            regards,

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              [quote author="alfah" date="1310534091"]The thing is, i couldn get how to use QcameraExposure::Flashmode. I found "QCameraExposure::FlashOn 0x4 Flash is On." in the docs but how do you use it?[/quote]

              For every enum in Qt there is usually a getter called enumName() and a setter setEnumName(). For the "QCameraExposure::FlashMode":http://doc.qt.nokia.com/qtmobility-1.1-tp/qcameraexposure.html#FlashMode-enum enum this will be "QCameraExposure::flashMode()":http://doc.qt.nokia.com/qtmobility-1.1-tp/qcameraexposure.html#flashMode and "QCameraExposure::setFlashMode()":http://doc.qt.nokia.com/qtmobility-1.1-tp/qcameraexposure.html#setFlashMode.

              You will find a list of the possible flash modes in the same document:

              bq. QCameraExposure::FlashOff
              QCameraExposure::FlashOn
              QCameraExposure::FlashAuto
              QCameraExposure::FlashRedEyeReduction
              QCameraExposure::FlashFill
              QCameraExposure::FlashTorch
              QCameraExposure::FlashSlowSyncFrontCurtain
              QCameraExposure::FlashSlowSyncRearCurtain
              QCameraExposure::FlashManual

              To get the current flash mode use
              @
              QCamera* camera = new QCamera;
              QCameraExposure* cameraExposure = camera.exposure();

              FlashModes flashMode = cameraExposure->flashMode();
              @
              To set a flash mode (for example always on) use
              @
              QCamera* camera = new QCamera;
              QCameraExposure* cameraExposure = camera.exposure();

              cameraExposure->setFlashMode(QCameraExposure::FlashTorch);
              @
              Hint: see also "QCameraExposure::isAvailable()":http://doc.qt.nokia.com/qtmobility-1.1-tp/qcameraexposure.html#isAvailable.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                alfah
                wrote on last edited by
                #7

                Thanks Lukas.

                That was indeed informative and the precisely what i needed .
                But now there is a small problem. When i run the prog, i get this error
                "QCameraExposure::QcameraExposure(Qcamera*) " is private!!!.. :(
                Wat does it mean?, tht i've created an instance of QCameraExposure it as private??? of i should declare it as private??

                Thank you.

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lgeyer
                  wrote on last edited by
                  #8

                  There is no public constructor for the QCameraExposure object, which means that you cannot directly create an object of the QCameraExposure class (which itself is a design decision taken by the creator of the QCameraExposure class).

                  You will have to use "QCamera::exposure()":http://doc.qt.nokia.com/qtmobility-1.1-tp/qcamera.html#exposure instead to retrieve a QCameraExposure object.

                  The example might be a bit misleading - I corrected it so it should reflect real world code.

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kkrzewniak
                    wrote on last edited by
                    #9

                    @QCameraExposure * QCamera::exposure () const@
                    Returns the camera exposure control object.
                    Sorry I'm a bit late :)

                    Me, Grimlock, not "nice dino". ME BASH BRAINS!

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      alfah
                      wrote on last edited by
                      #10

                      :) thanks lukas

                      bein a newbie am i dealin with tough stuff????? :(

                      cuz now i get jus one error and it says "

                      "request for member setFlashMode in cameraexpo, which is of non class type 'QCameraExposure' "

                      this is the code ive used in the function

                      { QCamera *camera = new QCamera;
                      QCameraExposure *cameraexpo = camera->exposure();
                      cameraexpo.setFlashMode(QCameraExposure::FlashOn);

                      }

                      regards,

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        alfah
                        wrote on last edited by
                        #11

                        hey kkrzewniak

                        thank you, but i could not make head or tail of that oneliner code. :)

                        It returns a camera exposure ctrl obj? meanin?

                        regards,

                        P.S one basic question, is it necessary to switch on the camera to set flash on??

                        regards,

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          lgeyer
                          wrote on last edited by
                          #12

                          Have you included the QCameraExposure header?
                          @
                          #include <QCameraExposure>
                          @

                          1 Reply Last reply
                          0
                          • L Offline
                            L Offline
                            loladiro
                            wrote on last edited by
                            #13

                            It's
                            @
                            cameraexpo->setFlashMode(QCameraExposure::FlashOn);
                            @
                            not
                            @
                            cameraexpo.setFlashMode(QCameraExposure::FlashOn);
                            @

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              alfah
                              wrote on last edited by
                              #14

                              @loladiro,
                              thanks! -> did the trick!! i finally got the prog running on c7 with out errors.

                              @lukas, loladiro, kkrzewniak

                              :( but then, when FlashOn was used i got the following msg
                              [Qt Message] camera error: "failed to set flash mode" :( :(

                              When i tried to use FlashTorch, i got
                              [Qt Message] Camera error: "Requested flash mode is not supported." :( :(

                              so wat next???

                              but there are apps which run in c7 which uses flash as torch!!!!!

                              thanks a lot for the help;

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                slava.chernikoff
                                wrote on last edited by
                                #15

                                Did anyone found a solution how to use camera LED as torch in Qt applications?

                                All suggested solutions like using setFlashMode(bla-bla-bla) doesn't work. But there are a lot of torches for Symbian and Meego... There are should be low-level platform for that trick I guess. But how to find it?

                                there.is.no.right.way

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  singaporeseo
                                  wrote on last edited by
                                  #16

                                  take shot in bright place so that you don't need flash

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    slava.chernikoff
                                    wrote on last edited by
                                    #17

                                    It's not about taking pictures. It about - how to use phone as torch.

                                    there.is.no.right.way

                                    1 Reply Last reply
                                    0
                                    • J Offline
                                      J Offline
                                      jim_kaiser
                                      wrote on last edited by
                                      #18

                                      To set the camera flash mode, you need to wait until the camera is initialized. So, connect a slot to the QCamera::statusChanged(QCamera::Status) and in your slot, set the flash mode when the camera is in QCamera::ActiveStatus. I don't know if the torch thingy would work but flash should.
                                      The other app with the torch thingy could probably be using native Symbian code to do it.

                                      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