增加相机调试窗口、添加便于相机设置的接口等
parent
7b041596f9
commit
9573e77c7f
@ -0,0 +1,83 @@
|
||||
#include "QCamSetDlg.h"
|
||||
|
||||
QCamSetDlg::QCamSetDlg(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
m_ViewImg = new QTpGraphView;
|
||||
QGridLayout *pGrid = new QGridLayout(this);
|
||||
pGrid->addWidget(m_ViewImg);
|
||||
ui.m_ImageLabel->setLayout(pGrid);
|
||||
|
||||
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
|
||||
connect(ui.pushButton_2, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
|
||||
connect(ui.pushButton_3, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
|
||||
}
|
||||
|
||||
QCamSetDlg::~QCamSetDlg()
|
||||
{
|
||||
if (m_ViewImg) {
|
||||
delete m_ViewImg;
|
||||
m_ViewImg = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void QCamSetDlg::setCamParam(ICoreCtrl* ptr, QString strCamkey)
|
||||
{
|
||||
m_curCamKey = strCamkey;
|
||||
m_pCorl = ptr;
|
||||
TP_CAMERA_OPTION camOpt;
|
||||
bool b = m_pCorl->ICameraOptionByKey(strCamkey,camOpt);
|
||||
if (b == true)
|
||||
{
|
||||
ui.m_camSnlineEdit->setText(m_curCamKey);
|
||||
ui.comboBox_2->setCurrentIndex(camOpt.deviceType);
|
||||
ui.comboBox->setCurrentIndex(camOpt.format);
|
||||
ui.lineEdit_2->setText(QString("%1").arg(camOpt.exposure));
|
||||
ui.lineEdit_3->setText(QString("%1").arg(camOpt.gain));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void QCamSetDlg::onShowImage(QString strKey, QImage img)
|
||||
{
|
||||
if (this->isHidden())
|
||||
return;
|
||||
if (strKey != m_curCamKey)
|
||||
return;
|
||||
|
||||
if (m_ViewImg)
|
||||
{
|
||||
m_ViewImg->setImg(QPixmap::fromImage(img));
|
||||
}
|
||||
}
|
||||
|
||||
Q_SLOT void QCamSetDlg::onButtonClicked()
|
||||
{
|
||||
QString strObj = sender()->objectName();
|
||||
if ("pushButton" == strObj)//±£´æ
|
||||
{
|
||||
|
||||
}
|
||||
else if ("pushButton_2" == strObj)//´ò¿ª
|
||||
{
|
||||
// m_pCorl->IOpenCamera(m_curCamKey);
|
||||
// m_pCorl->IStartCamera(m_curCamKey);
|
||||
m_pCorl->IRunAlg(m_curCamKey, false);
|
||||
// m_pCorl->ISnapImage(QStringList()<<m_curCamKey);
|
||||
|
||||
}
|
||||
else if ("pushButton_3" == strObj)//Ó¦ÓÃ
|
||||
{
|
||||
int exposure = ui.lineEdit_2->text().toInt();
|
||||
int gain = ui.lineEdit_3->text().toInt();
|
||||
}
|
||||
}
|
||||
|
||||
void QCamSetDlg::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (m_pCorl)
|
||||
{
|
||||
m_pCorl->IRunAlg(m_curCamKey, true);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
#ifndef _H_QCAMSETDLG_H_
|
||||
#define _H_QCAMSETDLG_H_
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_QCamSetDlg.h"
|
||||
#include "iCoreCtrl.h"
|
||||
#include "cunstomgraphview.h"
|
||||
#include <QCloseEvent>
|
||||
class QCamSetDlg : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QCamSetDlg(QWidget *parent = Q_NULLPTR);
|
||||
~QCamSetDlg();
|
||||
|
||||
void setCamParam(ICoreCtrl* ptr, QString strCam);
|
||||
|
||||
Q_SLOT void onShowImage(QString strKey, QImage img);
|
||||
Q_SLOT void onButtonClicked();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
private:
|
||||
Ui::QCamSetDlg ui;
|
||||
QTpGraphView *m_ViewImg{ nullptr };
|
||||
|
||||
QString m_curCamKey;
|
||||
|
||||
ICoreCtrl* m_pCorl{ nullptr };
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue