出现问题
最近在Qt中调用摄像头发现了图像无法捕获的问题。
并出现如下报错:
qt.qpa.window: <QNSWindow: 0x7fd517813440; contentView=<QNSView: 0x7fd517923870; QCocoaWindow(0x600003a840b0, window=QWidgetWindow(0x600002987f00, name="QCameraViewfinderClassWindow"))>> has active key-value observers (KVO)! These will stop working now that the window is recreated, and will result in exceptions when the observers are removed. Break in QCocoaWindow::recreateWindowIfNeeded to debug.
最新解决办法
后经 查阅资料发现是Mac系统无法调用&QCameraImageCapture::imageCaptured函数。
原先是通过imageCaptured(int,QImage)获取图片, 现改用imageSaved(int, const QString &)信号。
部分代码
ImageText::ImageText(QWidget *parent)
: QWidget(parent)
, ui(new Ui::ImageText)
{
ui->setupUi(this);
//设置摄像头功能
camera = new QCamera();
finder = new QCameraVie