代码下载
https://download.csdn.net/download/u010168781/10373174
#####头文件
#ifndef CAMERATEST_H
#define CAMERATEST_H
#include <QMainWindow>
#include <QGraphicsView>
#include <QKeyEvent>
#include <QTimer>
namespace Ui {
class CameraTest;
}
class QCamera;
class QCameraImageCapture;
class QGraphicsVideoItem;
class QGraphicsScene;
class QGraphicsView;
class QGraphicsTextItem;
class CameraTest : public QMainWindow
{
Q_OBJECT
public:
explicit CameraTest(QWidget *parent = 0);
~CameraTest();
private:
Ui::CameraTest *ui;
private slots:
void slotExitBtn();
void slotImageCaptureBtn(int, QImage image);
void slotTimer();
private:
QCamera* myCamera;
QCameraImageCapture* myImageCapture;
QGraphicsVideoItem* myGraphicsVideoItem;
QGraphicsScene* myGraphicsScene;
QGraphicsView* myGraphicsView;
QGraphicsTextItem* myGraphicsTextItem;
QTimer* myTimer;
bool