[Interest] QCamera flash modes

Jason H jhihn at gmx.com
Wed Jul 22 22:41:01 CEST 2015

This is not working. 

So In QML, I start the backface camera, and it grabs viewfinder frames. 
I then call my C++ object which has this function:
bool FlashControl::isFlashSupported(){
	camera = new QCamera(QCamera::BackFace);
	if (camera) {
		QCameraExposure *exp = camera->exposure();
		if (exp) {
			qDebug() << "QCamera ok, returning flash modes"
					<< exp->isFlashModeSupported(QCameraExposure::FlashOn)
					<< exp->isFlashModeSupported(QCameraExposure::FlashAuto)
					<< exp->isFlashModeSupported(QCameraExposure::FlashManual);

			return exp->isFlashModeSupported(QCameraExposure::FlashOn);
		else qDebug() << "has QCamera, no exp";
	} else qDebug() << "no QCamera";
	return false;

Which then prints all falses and returns false itself, even on a camera that has a working flash (Nexus6). What am I still doing wrong?

> Sent: Tuesday, July 21, 2015 at 9:19 AM
> From: "Lopes Yoann" <Yoann.Lopes at theqtcompany.com>
> To: "Jason H" <jhihn at gmx.com>
> Cc: interest <interest at qt-project.org>
> Subject: Re: [Interest] QCamera flash modes
> > On 20 Jul 2015, at 21:34, Jason H <jhihn at gmx.com> wrote:
> > 
> > However all I ever get is false. This is being run on an iPhone 5S, which does have a backface flash, and I do use the flash successfully in QML. I'm attempting to also support iPads which do not have a flash at all, but I need to know that the flash does not work.
> > 
> > Does anyone know what I might be doing wrong?
> You need to start the camera before being able to query for its capabilities.
>> Yoann

More information about the Interest mailing list