答案 0 :(得分:3)
该代码的问题在于您使用的是camera = new QCamera;
viewfinder = new QCameraViewfinder;
camera->setViewfinder(viewfinder);
viewfinder->show();
camera->start(); // to start the viewfinder
imageCapture = new QCameraImageCapture(camera);
camera->setCaptureMode(QCamera::CaptureStillImage);
camera->start(); // Viewfinder frames start flowing
camera->searchAndLock();
imageCapture->capture();
camera->unlock();
而不是PropTypes
。
注意小写字母“ p”
propTypes
验证道具时,有状态组件没有区别
这是您想在validating props
上阅读的链接。答案 1 :(得分:0)