1、修复没有标定的情况下,图片不能保存的问题

2、报表查看修改
master
bob.pan 4 years ago
parent 06f0edcc54
commit 8d8159e41c

@ -8,4 +8,7 @@
2021-10-18 2 2021-10-18 2
1、恢复检测数据结果保存和检测图片保存功能 1、恢复检测数据结果保存和检测图片保存功能
2、移除不需要的代码和接口 2、移除不需要的代码和接口
3、UI布局调整 3、UI布局调整
2021-10-18 3
1、修复串口不能正常打开问题

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -19,6 +19,7 @@ public:
virtual bool ISelModel(QString, QString) = 0; virtual bool ISelModel(QString, QString) = 0;
virtual bool ISaveModel(QString, QString) = 0; virtual bool ISaveModel(QString, QString) = 0;
virtual bool IStandard(QString strName ,QString strModel) = 0; virtual bool IStandard(QString strName ,QString strModel) = 0;
virtual QImage IGetStandardImg(QString strName, QString strModel) = 0;
virtual int IGetPLCIndex(QString strName, QString strModel) = 0; virtual int IGetPLCIndex(QString strName, QString strModel) = 0;
virtual bool ISetPLCIndex(QString strName, QString strModel, int plcIndex) = 0; virtual bool ISetPLCIndex(QString strName, QString strModel, int plcIndex) = 0;
virtual QString IFindModelName(QString strName, int plcIndex) = 0; virtual QString IFindModelName(QString strName, int plcIndex) = 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

@ -144,7 +144,7 @@ bool Station::updateCurrentModel2Label()
bool bCali = false; bool bCali = false;
bCali = IStandard(m_strCurrentModel); bCali = IStandard(m_strCurrentModel);
QString strText = "<html><body><h4><span style = '%1'>%2: %3 __ %4< /span>< /h4>< /body>< /html>"; QString strText = "<html><body><h4><span style = '%1'>%2: %3_%4< /span>< /h4>< /body>< /html>";
strText = strText.arg("color:#ff0000;") strText = strText.arg("color:#ff0000;")
.arg(tr("当前检测型号")) .arg(tr("当前检测型号"))
.arg(m_strCurrentModel == "" ? "?" : m_strCurrentModel) .arg(m_strCurrentModel == "" ? "?" : m_strCurrentModel)

@ -14,6 +14,39 @@
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
static QImage cvMat2QImage_2(const cv::Mat& mat) {
if (mat.type() == CV_8UC1) {
QImage image(mat.cols, mat.rows, QImage::Format_Indexed8);
image.setColorCount(256);
for (int i = 0; i < 256; i++) {
image.setColor(i, qRgb(i, i, i));
}
uchar *pSrc = mat.data;
for (int row = 0; row < mat.rows; row++) {
uchar *pDest = image.scanLine(row);
memcpy(pDest, pSrc, mat.cols);
pSrc += mat.step;
}
return image;
}
else if (mat.type() == CV_8UC3) {
const uchar *pSrc = (const uchar*)mat.data;
QImage image(pSrc, mat.cols, mat.rows, mat.step, QImage::Format_RGB888);
if (image.isNull())
return QImage();
return image.rgbSwapped();
}
else if (mat.type() == CV_8UC4) {
const uchar *pSrc = (const uchar*)mat.data;
QImage image(pSrc, mat.cols, mat.rows, mat.step, QImage::Format_ARGB32);
return image.copy();
}
else {
qDebug() << "ERROR: Mat could not be converted to QImage.";
return QImage();
}
}
CWfCtrl::CWfCtrl(IDetectorEngine* ptr) CWfCtrl::CWfCtrl(IDetectorEngine* ptr)
{ {
m_rootPath = QApplication::applicationDirPath(); m_rootPath = QApplication::applicationDirPath();
@ -304,3 +337,28 @@ bool CWfCtrl::IStandard(QString strName, QString strModel)
} }
return false; return false;
} }
QImage CWfCtrl::IGetStandardImg(QString strName, QString strModel)
{
if (m_pEngine)
{
IDetectorSolutionMgr* pSolutionMgr = m_pEngine->getSolutionMgr();
if (!pSolutionMgr)
return QImage();
QMap<QString, IDetectorSolution*> solutionMap = pSolutionMgr->GetAllSolutions();
QMap<QString, IDetectorSolution*>::iterator it = solutionMap.find(strName);
if (it != solutionMap.end())
{
IDetectorSolution *p = *it;
IDetectorTask* pTask = p->GetTaskByName(strModel);
if (pTask->GetTaskInfo()->templateImg.data == nullptr)
return QImage();
else
{
return cvMat2QImage_2(pTask->GetTaskInfo()->templateImg);
}
}
}
return QImage();
}

@ -6,7 +6,7 @@
#include <QSettings> #include <QSettings>
#include "IWfCtrl.h" #include "IWfCtrl.h"
#include "lpbengine.h" #include "lpbengine.h"
#include <QImage>
class CWfCtrl : public IWfCtrl class CWfCtrl : public IWfCtrl
{ {
Q_OBJECT Q_OBJECT
@ -18,6 +18,7 @@ public:
virtual IStation* IGetStationByKey(QString); virtual IStation* IGetStationByKey(QString);
virtual bool IStandard(QString strName,QString strModel); virtual bool IStandard(QString strName,QString strModel);
virtual QImage IGetStandardImg(QString strName, QString strModel);
virtual int IGetPLCIndex(QString strName, QString strModel); virtual int IGetPLCIndex(QString strName, QString strModel);
virtual bool ISetPLCIndex(QString strName, QString strModel, int plcIndex); virtual bool ISetPLCIndex(QString strName, QString strModel, int plcIndex);
virtual QString IFindModelName(QString strName, int plcIndex); virtual QString IFindModelName(QString strName, int plcIndex);

@ -22,4 +22,7 @@
<file>Resource/app.png</file> <file>Resource/app.png</file>
<file>Resource/app2.png</file> <file>Resource/app2.png</file>
</qresource> </qresource>
<qresource prefix="/">
<file>Resource/no-img.png</file>
</qresource>
</RCC> </RCC>

@ -1,7 +0,0 @@
#include "Report.h"
Report::Report(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
}

@ -1,15 +0,0 @@
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_Report.h"
class Report : public QMainWindow
{
Q_OBJECT
public:
Report(QWidget *parent = Q_NULLPTR);
private:
Ui::ReportClass ui;
};

@ -1,29 +0,0 @@
<UI version="4.0" >
<class>ReportClass</class>
<widget class="QMainWindow" name="ReportClass" >
<property name="objectName" >
<string notr="true">ReportClass</string>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle" >
<string>Report</string>
</property>
<widget class="QMenuBar" name="menuBar" />
<widget class="QToolBar" name="mainToolBar" />
<widget class="QWidget" name="centralWidget" />
<widget class="QStatusBar" name="statusBar" />
</widget>
<layoutDefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<resources>
<include location="Report.qrc"/>
</resources>
<connections/>
</UI>

@ -122,14 +122,9 @@
<ClCompile Include="..\..\src\lpMain\sqliteDB\stationdb.cpp" /> <ClCompile Include="..\..\src\lpMain\sqliteDB\stationdb.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<ClCompile Include="qcheckdatadlg.cpp" /> <ClCompile Include="qcheckdatadlg.cpp" />
<ClCompile Include="Report.cpp" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="Report.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="qcheckdatadlg.ui" /> <QtUic Include="qcheckdatadlg.ui" />
<QtUic Include="Report.ui" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtRcc Include="Report.qrc" /> <QtRcc Include="Report.qrc" />

@ -36,9 +36,6 @@
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Report.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\lpMain\sqliteDB\databasesql.cpp"> <ClCompile Include="..\..\src\lpMain\sqliteDB\databasesql.cpp">
<Filter>db</Filter> <Filter>db</Filter>
</ClCompile> </ClCompile>
@ -62,9 +59,6 @@
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="Report.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="..\..\src\lpMain\sqliteDB\databasesql.h"> <QtMoc Include="..\..\src\lpMain\sqliteDB\databasesql.h">
<Filter>db</Filter> <Filter>db</Filter>
</QtMoc> </QtMoc>
@ -79,9 +73,6 @@
</QtMoc> </QtMoc>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="Report.ui">
<Filter>Form Files</Filter>
</QtUic>
<QtUic Include="qcheckdatadlg.ui"> <QtUic Include="qcheckdatadlg.ui">
<Filter>Form Files</Filter> <Filter>Form Files</Filter>
</QtUic> </QtUic>

@ -1,4 +1,3 @@
#include "Report.h"
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
#include "stationdb.h" #include "stationdb.h"
#include "qcheckdatadlg.h" #include "qcheckdatadlg.h"

@ -329,8 +329,6 @@ Q_SLOT void QCheckDataDlg::onTBUI_ItemClick(const QModelIndex & index)
} }
} }
} }
int i = 0;
} }
Q_SLOT void QCheckDataDlg::onSlowPixmap(QSqlQuery sql) Q_SLOT void QCheckDataDlg::onSlowPixmap(QSqlQuery sql)

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>902</width> <width>978</width>
<height>598</height> <height>633</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -81,6 +81,11 @@
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="groupBox_3">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="title"> <property name="title">
<string>查询操作</string> <string>查询操作</string>
</property> </property>
@ -192,6 +197,11 @@
<verstretch>8</verstretch> <verstretch>8</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="title"> <property name="title">
<string/> <string/>
</property> </property>
@ -276,7 +286,13 @@
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="7"> <item row="0" column="0" colspan="7">
<widget class="QTableView" name="tableView"/> <widget class="QTableView" name="tableView">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
</widget>
</item> </item>
<item row="1" column="0" colspan="7"> <item row="1" column="0" colspan="7">
<widget class="QLabel" name="check_fileName"> <widget class="QLabel" name="check_fileName">
@ -304,6 +320,11 @@
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>

@ -82,7 +82,11 @@ CMainWin::CMainWin(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
lpSysLog::instance()->Init();
lpSysConfig::instance()->readConfig();
lpSysConfig::instance()->writeConfig();
lpGlobalConfig::instance()->readConfig();
setWindowIcon(QIcon(LEAPER_LOGO)); setWindowIcon(QIcon(LEAPER_LOGO));
onInitCoreCtrl(); onInitCoreCtrl();
onInitSerial(); onInitSerial();
@ -90,10 +94,7 @@ CMainWin::CMainWin(QWidget *parent)
onInitUI(); onInitUI();
onInitStatus(); onInitStatus();
onInitDiskClean(); onInitDiskClean();
lpSysLog::instance()->Init();
lpSysConfig::instance()->readConfig();
lpSysConfig::instance()->writeConfig();
lpGlobalConfig::instance()->readConfig();
SYSLOG_STATUS << "系统启动"; SYSLOG_STATUS << "系统启动";
{ {
QString strPath = QCoreApplication::applicationDirPath(); QString strPath = QCoreApplication::applicationDirPath();
@ -1071,10 +1072,6 @@ void CMainWin::saveSolution()
} }
Q_SLOT void CMainWin::onMainFrameClose()
{
}
//相机触发 //相机触发
Q_SLOT void CMainWin::onSnapImage(int nCamera /*= -1*/) Q_SLOT void CMainWin::onSnapImage(int nCamera /*= -1*/)
{ {
@ -1096,11 +1093,6 @@ Q_SLOT void CMainWin::onTrigImage()
onSnapImage(2); onSnapImage(2);
} }
Q_SLOT void CMainWin::onSelModel(int nId, QString strModel)
{
}
Q_SLOT void CMainWin::onChangeUI(QString strUsr, int nLevel) Q_SLOT void CMainWin::onChangeUI(QString strUsr, int nLevel)
{ {
switch (nLevel) { switch (nLevel) {
@ -1303,6 +1295,7 @@ void CMainWin::IEngineResult(QVariantMap vMap)
bool taskCali = vMap.value("taskCali").toBool();//标定标志位 使用有标定图来判断 bool taskCali = vMap.value("taskCali").toBool();//标定标志位 使用有标定图来判断
QString solutionName = vMap.value("solutionName").toString(); QString solutionName = vMap.value("solutionName").toString();
QString taskName = vMap.value("taskName").toString(); QString taskName = vMap.value("taskName").toString();
double taskTime = vMap.value("tasktime").toDouble();
if (taskCali == false)//模板未标定 if (taskCali == false)//模板未标定
{ {
int stationID = 0; int stationID = 0;
@ -1318,6 +1311,11 @@ void CMainWin::IEngineResult(QVariantMap vMap)
strResult += " No Cali!!!"; strResult += " No Cali!!!";
emit sgShowLog(stationID, strResult); emit sgShowLog(stationID, strResult);
sendResult(stationID, 361, 0, 0); sendResult(stationID, 361, 0, 0);
//只保存原图
if ((lpSysConfig::instance()->m_bSaveSrcImg_st1 == true && stationID == 1)
|| (lpSysConfig::instance()->m_bSaveSrcImg_st2 == true && stationID == 2))
genSaveSrcImgPath(taskName, srcImg);
return; return;
} }
//不包含算法检测结果表示没有相关task //不包含算法检测结果表示没有相关task
@ -1338,6 +1336,10 @@ void CMainWin::IEngineResult(QVariantMap vMap)
strResult += " No Task!!!"; strResult += " No Task!!!";
emit sgShowLog(stationID, strResult); emit sgShowLog(stationID, strResult);
sendResult(stationID, 361, 0, 0); sendResult(stationID, 361, 0, 0);
if ((lpSysConfig::instance()->m_bSaveSrcImg_st1 == true && stationID == 1)
|| (lpSysConfig::instance()->m_bSaveSrcImg_st2 == true && stationID == 2))
genSaveSrcImgPath(taskName, srcImg);
} }
else { else {
QVariantMap algResult = vMap.value("AlgoResult").toMap(); QVariantMap algResult = vMap.value("AlgoResult").toMap();
@ -1348,8 +1350,6 @@ void CMainWin::IEngineResult(QVariantMap vMap)
QImage rltImg = algResult.value("image").value<QImage>(); QImage rltImg = algResult.value("image").value<QImage>();
QString strResultTip = algResult.value("resultTip").toString(); QString strResultTip = algResult.value("resultTip").toString();
QPointF centerPoint = algResult.value("centerPoint").toPointF(); QPointF centerPoint = algResult.value("centerPoint").toPointF();
QString taskName = vMap.value("taskName").toString();
double taskTime = vMap.value("tasktime").toDouble();
double centerX = 0.0; double centerX = 0.0;
double centerY = 0.0; double centerY = 0.0;
@ -1392,8 +1392,6 @@ void CMainWin::IEngineResult(QVariantMap vMap)
nStructData.value1 = strImgPath; nStructData.value1 = strImgPath;
nStructData.value2 = str2; nStructData.value2 = str2;
m_db->addData2DB(nStructData); m_db->addData2DB(nStructData);
// onSaveValveResult(valueRlt);
/*展示结果*/ /*展示结果*/
onShowImage(stationID, rltImg); onShowImage(stationID, rltImg);

@ -95,11 +95,9 @@ private://
private: private:
void saveSolution(); void saveSolution();
int lastNum(QString str); int lastNum(QString str);
Q_SLOT void onMainFrameClose();
Q_SLOT void onSnapImage(int nCamera = -1); Q_SLOT void onSnapImage(int nCamera = -1);
Q_SLOT void onTrigImage(); Q_SLOT void onTrigImage();
Q_SLOT void onSelModel(int, QString);
Q_SLOT void onChangeUI(QString strUsr, int nLevel); Q_SLOT void onChangeUI(QString strUsr, int nLevel);
Q_SLOT void onLogInOut(QString strName, int level, int state); Q_SLOT void onLogInOut(QString strName, int level, int state);
Q_SLOT void onTestMode(int); Q_SLOT void onTestMode(int);

@ -14,6 +14,14 @@ QModelMangerUI::QModelMangerUI(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
m_srcImgView = replaceWidget<lpImgViewer>(ui.widget);
//connect(m_srcImgView, SIGNAL(filterroiChanged(const AwesomeRoiInfo&, QString)), this, SLOT(onROIChange(const AwesomeRoiInfo&, QString)));
//connect(m_srcImgView, SIGNAL(pixelClicked(QPoint)), this, SLOT(onPixelClicked(QPoint)));
//connect(m_srcImgView, SIGNAL(roiLockIng(QString)), this, SLOT(onRoiLockIng(QString)));
//connect(m_srcImgView, SIGNAL(sgImageScale(qreal)), this, SLOT(onImageScale(qreal)));
ui.wf_model_mod_button->setVisible(false); ui.wf_model_mod_button->setVisible(false);
connect(ui.wf_model_select_button, SIGNAL(clicked()), this, SLOT(onButtonClicked())); connect(ui.wf_model_select_button, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(ui.wf_model_add_button, SIGNAL(clicked()), this, SLOT(onButtonClicked())); connect(ui.wf_model_add_button, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
@ -24,6 +32,27 @@ QModelMangerUI::QModelMangerUI(QWidget *parent)
QModelMangerUI::~QModelMangerUI() QModelMangerUI::~QModelMangerUI()
{ {
if (m_srcImgView) {
delete m_srcImgView;
m_srcImgView = nullptr;
}
}
template<typename _Widget>
_Widget* QModelMangerUI::replaceWidget(QWidget* pSrcWidget)
{
if (!pSrcWidget) {
return nullptr;
}
QWidget* pParent = qobject_cast<QWidget*>(pSrcWidget->parent());
if (!pParent) {
return nullptr;
}
_Widget* pDstWidget = new _Widget;
auto *pFrom = pParent->layout()->replaceWidget(pSrcWidget, pDstWidget);
delete pFrom;
delete pSrcWidget;
return pDstWidget;
} }
Q_SLOT void QModelMangerUI::onButtonClicked() Q_SLOT void QModelMangerUI::onButtonClicked()
@ -117,6 +146,44 @@ int QModelMangerUI::lastNum(QString str)
return str.right(1).toInt(); return str.right(1).toInt();
} }
Q_SLOT bool QModelMangerUI::OnCellClicked(const QModelIndex &index)
{
QString strListName = sender()->objectName();
if (1 != index.column()) {
return false;
}
QString key = m_tabViewKeys.value(strListName);
int stationID = lastNum(strListName);
IStation *pStation = m_pCtrl->IGetStationByKey(key);
if (pStation) {
QString strModel = pStation->model(index.row());
QString strName = QObject::tr("Ä£ÐͺÅ:") + strModel;
int plcIndex = m_pCtrl->IGetPLCIndex(key, strModel);
ui.label_Name->setText(strModel);
QImage img = m_pCtrl->IGetStandardImg(key, strModel);
if (img.isNull())
{
img.load(":/Resource/no-img.png");
}
int widgetWidth = m_srcImgView->width();
int imgWidth = img.width();
float scalew = (widgetWidth*1.0) / (imgWidth*1.0);
int widgetHeight = m_srcImgView->height();
int imgHeight = img.height();
float scaleh = (widgetHeight*1.0) / (imgHeight*1.0);
float minScale = scalew < scaleh ? scalew : scaleh;
// m_srcImgView->setIsAutoResetToWindowSize(true);
// m_srcImgView->setIsAutoResetTransform(true);
m_srcImgView->setInitScale(minScale - 0.01);
m_srcImgView->clear();
m_srcImgView->setImg(img);
}
return true;
}
Q_SLOT bool QModelMangerUI::OnCellDoubleClicked(const QModelIndex &index) Q_SLOT bool QModelMangerUI::OnCellDoubleClicked(const QModelIndex &index)
{ {
QString strListName = sender()->objectName(); QString strListName = sender()->objectName();
@ -175,31 +242,16 @@ Q_SLOT void QModelMangerUI::onCheckBoxChange(int state)
if (state > 0) if (state > 0)
{ {
ui.wf_model_select_button->setDisabled(true); ui.wf_model_select_button->setDisabled(true);
// if (m_pCtrl)
// m_pCtrl->ISetOnlineModel(true);
lpGlobalConfig::instance()->m_bOnlineMode = true; lpGlobalConfig::instance()->m_bOnlineMode = true;
lpGlobalConfig::instance()->writeConfig(); lpGlobalConfig::instance()->writeConfig();
} }
else { else {
ui.wf_model_select_button->setDisabled(false); ui.wf_model_select_button->setDisabled(false);
// if (m_pCtrl)
// m_pCtrl->ISetOnlineModel(false);
lpGlobalConfig::instance()->m_bOnlineMode = false; lpGlobalConfig::instance()->m_bOnlineMode = false;
lpGlobalConfig::instance()->writeConfig(); lpGlobalConfig::instance()->writeConfig();
} }
} }
// IStation * QModelMangerUI::getStation(int nIndex)
// {
// if (nIndex == -1) {
// QWidget *pWidget = ui.tabWidgetStation->currentWidget();
// if (pWidget) {
// nIndex = lastNum(pWidget->objectName());
// }
// }
// return m_pCtrl->IGetStationById(nIndex);
// }
void QModelMangerUI::showEvent(QShowEvent *event) void QModelMangerUI::showEvent(QShowEvent *event)
{ {
if (m_pCtrl) { if (m_pCtrl) {
@ -247,6 +299,7 @@ void QModelMangerUI::onInitModelList(IWfCtrl *pCtrl)
pW->setObjectName(strObjName); pW->setObjectName(strObjName);
ui.tabWidgetStation->addTab((QWidget*)pW, var); ui.tabWidgetStation->addTab((QWidget*)pW, var);
pStation->setView(pW); pStation->setView(pW);
connect(pW, SIGNAL(clicked(const QModelIndex &)), this, SLOT(OnCellClicked(const QModelIndex &)));
connect(pW, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(OnCellDoubleClicked(const QModelIndex &))); connect(pW, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(OnCellDoubleClicked(const QModelIndex &)));
nIndex++; nIndex++;
} }

@ -3,6 +3,7 @@
#include <QWidget> #include <QWidget>
#include "ui_QModelMangerUI.h" #include "ui_QModelMangerUI.h"
#include "Station.h" #include "Station.h"
#include "lpImgViewer.h"
class QModelMangerUI : public QWidget class QModelMangerUI : public QWidget
{ {
@ -16,9 +17,13 @@ public:
Q_SLOT void onButtonClicked(); Q_SLOT void onButtonClicked();
int lastNum(QString str); int lastNum(QString str);
Q_SLOT bool OnCellDoubleClicked(const QModelIndex &index); Q_SLOT bool OnCellClicked(const QModelIndex &index);//单击事件
Q_SLOT bool OnCellDoubleClicked(const QModelIndex &index);//双击事件
Q_SLOT void onCheckBoxChange(int state); Q_SLOT void onCheckBoxChange(int state);
QString currentTab(); QString currentTab();
template<typename _Widget>
_Widget* replaceWidget(QWidget* pSrcWidget);
protected: protected:
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent *event);
virtual void closeEvent(QCloseEvent *event); virtual void closeEvent(QCloseEvent *event);
@ -27,6 +32,9 @@ private:
Ui::QModelMangerUI ui; Ui::QModelMangerUI ui;
IWfCtrl *m_pCtrl{ nullptr }; IWfCtrl *m_pCtrl{ nullptr };
QMap<QString, QString> m_tabViewKeys; QMap<QString, QString> m_tabViewKeys;
lpImgViewer *m_srcImgView{ nullptr };
}; };
#endif #endif

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>671</width> <width>856</width>
<height>450</height> <height>509</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
@ -20,172 +20,250 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidgetStation"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="sizePolicy"> <property name="sizeConstraint">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <enum>QLayout::SetMaximumSize</enum>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="minimumSize"> <item>
<size> <widget class="QTabWidget" name="tabWidgetStation">
<width>0</width> <property name="sizePolicy">
<height>23</height> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
</size> <horstretch>5</horstretch>
</property> <verstretch>0</verstretch>
<property name="maximumSize"> </sizepolicy>
<size> </property>
<width>16777215</width> <property name="minimumSize">
<height>44444</height> <size>
</size> <width>0</width>
</property> <height>23</height>
<property name="tabPosition"> </size>
<enum>QTabWidget::North</enum> </property>
</property> <property name="maximumSize">
<property name="tabShape"> <size>
<enum>QTabWidget::Rounded</enum> <width>16777215</width>
</property> <height>44444</height>
<property name="currentIndex"> </size>
<number>-1</number> </property>
</property> <property name="tabPosition">
</widget> <enum>QTabWidget::North</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>4</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>标定图:</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="0" column="0">
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>358</width>
<height>358</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>358</width>
<height>358</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(170, 255, 127);</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>型号名:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Name">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>xxxx</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QFrame" name="frame"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="maximumSize"> <item>
<size> <widget class="QFrame" name="frame">
<width>16777215</width> <property name="maximumSize">
<height>50</height> <size>
</size> <width>16777215</width>
</property> <height>50</height>
<property name="frameShape"> </size>
<enum>QFrame::Box</enum> </property>
</property> <property name="frameShape">
<property name="frameShadow"> <enum>QFrame::Box</enum>
<enum>QFrame::Raised</enum> </property>
</property> <property name="frameShadow">
<property name="lineWidth"> <enum>QFrame::Raised</enum>
<number>2</number> </property>
</property> <property name="lineWidth">
<layout class="QHBoxLayout" name="horizontalLayout"> <number>2</number>
<property name="leftMargin"> </property>
<number>3</number> <layout class="QHBoxLayout" name="horizontalLayout">
</property> <property name="leftMargin">
<property name="topMargin"> <number>3</number>
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QPushButton" name="wf_model_add_button">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>添加</string>
</property> </property>
</widget> <property name="topMargin">
</item> <number>3</number>
<item>
<widget class="QPushButton" name="wf_model_mod_button">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property> </property>
<property name="font"> <property name="rightMargin">
<font> <number>3</number>
<pointsize>12</pointsize>
</font>
</property> </property>
<property name="text"> <property name="bottomMargin">
<string>修改</string> <number>3</number>
</property> </property>
</widget> <item>
</item> <widget class="QPushButton" name="wf_model_add_button">
<item> <property name="minimumSize">
<widget class="QPushButton" name="wf_model_delete_button"> <size>
<property name="minimumSize"> <width>0</width>
<size> <height>25</height>
<width>0</width> </size>
<height>25</height> </property>
</size> <property name="font">
</property> <font>
<property name="font"> <pointsize>12</pointsize>
<font> </font>
<pointsize>12</pointsize> </property>
</font> <property name="text">
</property> <string>添加</string>
<property name="text"> </property>
<string>删除</string> </widget>
</property> </item>
</widget> <item>
</item> <widget class="QPushButton" name="wf_model_mod_button">
<item> <property name="minimumSize">
<widget class="QPushButton" name="wf_model_select_button"> <size>
<property name="minimumSize"> <width>0</width>
<size> <height>25</height>
<width>0</width> </size>
<height>25</height> </property>
</size> <property name="font">
</property> <font>
<property name="font"> <pointsize>12</pointsize>
<font> </font>
<pointsize>12</pointsize> </property>
</font> <property name="text">
</property> <string>修改</string>
<property name="text"> </property>
<string>设置为当前运行模型</string> </widget>
</property> </item>
</widget> <item>
</item> <widget class="QPushButton" name="wf_model_delete_button">
<item> <property name="minimumSize">
<widget class="QCheckBox" name="wf_chkbox_read_mode_from_plc"> <size>
<property name="minimumSize"> <width>0</width>
<size> <height>25</height>
<width>0</width> </size>
<height>25</height> </property>
</size> <property name="font">
</property> <font>
<property name="font"> <pointsize>12</pointsize>
<font> </font>
<family>微软雅黑</family> </property>
<pointsize>12</pointsize> <property name="text">
</font> <string>删除</string>
</property> </property>
<property name="text"> </widget>
<string>从PLC获取当前模型</string> </item>
</property> <item>
</widget> <widget class="QPushButton" name="wf_model_select_button">
</item> <property name="minimumSize">
</layout> <size>
</widget> <width>0</width>
</item> <height>25</height>
<item row="2" column="0"> </size>
<widget class="QLabel" name="mLblModelState"> </property>
<property name="maximumSize"> <property name="font">
<size> <font>
<width>16777215</width> <pointsize>12</pointsize>
<height>25</height> </font>
</size> </property>
</property> <property name="text">
<property name="text"> <string>设置为当前运行模型</string>
<string/> </property>
</property> </widget>
</widget> </item>
<item>
<widget class="QCheckBox" name="wf_chkbox_read_mode_from_plc">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>从PLC获取当前模型</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="mLblModelState">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>

@ -25,6 +25,6 @@ lpMain::~lpMain()
void lpMain::showWidget() void lpMain::showWidget()
{ {
m_wid.show(); m_wid.showMaximized();
} }

Loading…
Cancel
Save