On 22 Jul 2015, at 22:41, Jason H <jh...@gmx.com<mailto:jh...@gmx.com>> wrote:

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?

Having the QML Camera started doesn’t mean your C++ QCamera is started. They 
are two independent objects.

You need to call camera->start(). However, it’s not going to work if the camera 
is already started from the QML side, you need to do the check before starting 
the camera in QML. Another possibility is to pass the QML camera object to your 
C++ backend, and retrieve the actual QCamera object being in use:

void SomeClass:setQMLCamera(QObject *qmlCamera)
{
    QCamera *camera = qvariant_cast<QCamera 
*>(qmlCamera->property(“mediaObject”));

    ...
}

—
Yoann

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to