2019-09-07 23:32:36 +08:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
2019-09-08 09:15:01 +08:00
|
|
|
MainWindow::MainWindow ( QWidget* parent ) :
|
|
|
|
QMainWindow ( parent ),
|
|
|
|
ui ( new Ui::MainWindow )
|
2019-09-07 23:32:36 +08:00
|
|
|
{
|
2019-09-08 09:15:01 +08:00
|
|
|
ui->setupUi ( this );
|
|
|
|
|
|
|
|
manager = new QQtV4L2VideoManager ( this );
|
|
|
|
connect ( manager, SIGNAL ( readyRead ( QImage ) ), this, SLOT ( slotCaptured ( QImage ) ) );
|
2019-09-07 23:32:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
2019-09-08 09:15:01 +08:00
|
|
|
|
|
|
|
void MainWindow::on_pushButton_clicked()
|
|
|
|
{
|
|
|
|
manager->startCapture();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_2_clicked()
|
|
|
|
{
|
|
|
|
manager->stopCapture();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::slotCaptured ( const QImage& img )
|
|
|
|
{
|
|
|
|
ui->widget->setPixmap ( img );
|
|
|
|
}
|