我需要知道如何打开相机闪光灯或火炬灯使用qt?有办法这样做吗?我用的是qt 5.5。请给出建议。
这是我的密码
#include "flashon.h"
FlashOn::FlashOn()
{
cam = new QCamera;
camExpos = cam->exposure ();
}
FlashOn::~FlashOn()
{
delete this;
}
void FlashOn::lightOn()
{
camExpos->setFlashMode (QCameraExposure::FlashOn);
qDebug() << " light is on ";
}
发布于 2016-05-16 05:47:19
如果您阅读了文档,就会发现QCameraExposure::FlashTorch
在QCameraExposure::FlashModes
中。
camExpos->setFlashMode(QCameraExposure::FlashTorch);
并不是所有的设备都支持它:
QCameraExposure::FlashTorch -
0x20
-恒定光源.如果支持,火炬可以启用,而不加载相机。
因此,您可能希望检查它是否可用:
if (!camExpos->isFlashModeSupported(QCameraExposure::FlashTorch)) {
// ...not supported...
}
https://stackoverflow.com/questions/37229577
复制相似问题