Unsolved Ios camera flash
-
Is it possible to on/off camera flash?
-
@sashapont It's all in the documentation: http://doc.qt.io/qt-5/qcameraflashcontrol.html
-
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
-
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.
-
Please also use code tags, it makes posts much more readable. I've already edited your post and added them here.
-
@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 havestate: QCamera::LoadedState FlashTorch: false FlashOn: false flashMode: QFlags(0x2)
-
@sashapont Looks like the flash modes you want to use are not supported. Could be that they are not implemented in Qt on iOS.
-
Hi,
From a quick look at the sources, the flash is supported since 5.8. Which version of Qt are you using ?
-
@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