How to set the camera flash on
-
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. -
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 -
-
[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::FlashManualTo 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. -
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.
-
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.
-
@QCameraExposure * QCamera::exposure () const@
Returns the camera exposure control object.
Sorry I'm a bit late :) -
:) 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,
-
@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;
-
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?
-
take shot in bright place so that you don't need flash
-
It's not about taking pictures. It about - how to use phone as torch.
-
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.