#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()<text().toInt(); int gain = ui.lineEdit_3->text().toInt(); } } void QCamSetDlg::closeEvent(QCloseEvent *event) { if (m_pCorl) { m_pCorl->IRunAlg(m_curCamKey, true); } }