mycam.cpp.svn-base

来自「一个简单的摄像头播放程序,用qt做的界面」· SVN-BASE 代码 · 共 75 行

SVN-BASE
75
字号
#include "mycam.h"#include "v4l2.h"MyCam::MyCam()	:QDialog(){	ui.setupUi(this);	connect(ui.recordButton, SIGNAL(clicked()), this, SLOT(recordImage()));//	connect(stopButton, SIGNAL(clicked()), this, SLOT(stopVideo()));//	connect(recordButton, SIGNAL(clicked()), this, SLOT(recordVideo()));	connect(ui.recordButton, SIGNAL(clicked()), this, SLOT(buttonDisabled()));	connect(ui.stopButton, SIGNAL(clicked()), this, SLOT(buttonEnabled()));		display();	}void MyCam::recordVideo(){		}void MyCam::recordImage(){		}void MyCam::stopVideo(){		}void MyCam::flushBuff(){	QImage image;	read_frame (&pd);	image.loadFromData((uchar*)pd.buffers[pd.buf.index].start,			                     pd.fmt.fmt.pix.sizeimage);	ui.displayLabel->setPixmap(QPixmap::fromImage(image));	return_data(&pd);	}void MyCam::display(){	timer = new QTimer();	timer->start(40);	pd.dev_name = "/dev/video0";	init_dev(&pd);	connect(timer, SIGNAL(timeout()), this, SLOT(flushBuff()));	}void MyCam::buttonDisabled(){	ui.recordButton->setDisabled(TRUE);	}void MyCam::buttonEnabled(){	ui.recordButton->setEnabled(TRUE);	}void MyCam::paintEvent(QPaintEvent *event){	QImage image;	read_frame (&pd);	image.loadFromData((uchar*)pd.buffers[pd.buf.index].start,			                     pd.fmt.fmt.pix.sizeimage);	ui.displayLabel->setPixmap(QPixmap::fromImage(image));	return_data(&pd);		}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?