103 lines
2.5 KiB
C++
103 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
#include <qobject.h>
|
|
#include <qmetatype.h>
|
|
#include <qstring.h>
|
|
#include <qcolor.h>
|
|
#include <qpixmap.h>
|
|
|
|
#include <opencv.hpp>
|
|
#include <qvariant.h>
|
|
enum initStatus{
|
|
NotInit,
|
|
InitFailure,
|
|
InitOK
|
|
};
|
|
|
|
// 展示图片所需的打包结构体,用于在跨线程信号中携带图像与元信息
|
|
struct showImgPack{
|
|
cv::Mat img;
|
|
QString name = "";
|
|
QString type;
|
|
showImgPack() {};
|
|
showImgPack(QString name,QString type) : type(type), name(name) {}
|
|
};
|
|
|
|
enum valueType {
|
|
finsShort,
|
|
finsFloat
|
|
};
|
|
|
|
// PLC 值查看器的配置结构体
|
|
struct PlcValueViewerStruct {
|
|
QString valueName;
|
|
int valueAddr;
|
|
valueType type = finsShort;
|
|
QVariant value = -999;
|
|
};
|
|
|
|
class qtFuncBridge : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
qtFuncBridge() {
|
|
|
|
}
|
|
signals:
|
|
// 日志相关
|
|
void loadingWindow_appendInitLog(const QString& text, const QColor& color);
|
|
void loadingWindow_modifyLog(int col, const QString& text, const QColor& color);
|
|
void loadingWindow_clearLog();
|
|
|
|
// 登录结果
|
|
void initResult(initStatus result);
|
|
|
|
// 图像显示
|
|
void displayWidget_sendImg(showImgPack pack);
|
|
|
|
// 汇总数据
|
|
void summaryData_addData(QString window, double data);
|
|
|
|
//数据到界面
|
|
void pieWidgetAddNG();
|
|
void pieWidgetAddOK();
|
|
void histogramWidgetAddData(std::vector<std::string>);
|
|
void setPlcConnectionError();
|
|
void setPlcConnectionOk();
|
|
void setCamConnectionError();
|
|
void setCamConnectionOk();
|
|
|
|
///////////////////////////////////////////////
|
|
// 切换界面
|
|
void switchMainStakedWidget(int index);
|
|
|
|
// UI 效果
|
|
void passWordEditShake();
|
|
|
|
// 加载窗口状态图标
|
|
void loadingWindow_SetLoadingIcon();
|
|
void loadingWindow_SetErrorIcon();
|
|
void loadingWindow_SetErrorText(QString text);
|
|
|
|
// 警告日志
|
|
void loadingWindow_appendWarningLog(QString text);
|
|
void loadingWindow_clearWarningLog();
|
|
//////////////////////////////////////////////////////////////
|
|
void restartInit();
|
|
|
|
//排障
|
|
void runCommand_addBtn(const QString& btnName, const QString& tip, const QString& uuid);
|
|
void runCommand_addPlcValueViewer(QString groupName, std::vector<std::pair<QString, int>> viewerNameAndAddress);
|
|
void runCommand_refeshPlcValueViewer(int address,QString value);
|
|
|
|
//性能监测
|
|
void sendTriggerManagerLoopData(int loopCounterPerMin,int maxInterval);
|
|
|
|
void triggerAndCaptureImage(std::string cameraName, std::vector<cv::Mat>* mats);
|
|
};
|
|
|