You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
newValue/tpvs17/lpMain/QCamSetDlg.cpp

92 lines
2.0 KiB
C++

#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->IGetCameraOption(strCamkey,camOpt);
if (b == true)
{
ui.m_camSnlineEdit->setText(m_curCamKey);
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();
m_pCorl->ISetGain(m_curCamKey, gain);
m_pCorl->ISetExposureTime(m_curCamKey, exposure);
m_pCorl->saveConfig();
}
}
void QCamSetDlg::closeEvent(QCloseEvent *event)
{
if (m_pCorl)
{
m_pCorl->IRunAlg(m_curCamKey, true);
}
}
void QCamSetDlg::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
ui.retranslateUi(this);
}
}