201 lines
4.8 KiB
C++
201 lines
4.8 KiB
C++
#ifndef BACTERIA_H
|
|
#define BACTERIA_H
|
|
|
|
#include <QWidget>
|
|
#include <QMainWindow>
|
|
#include <QCamera> //管理摄像头的大类
|
|
//#include <QCameraInfo> //管理摄像头设别表
|
|
// #include <QCameraViewfinder> //管理摄像头显示区域
|
|
// #include <QCameraImageCapture> //管理图片
|
|
|
|
// #include<IMVDefines.h>
|
|
// #include<IMVApi.h>
|
|
#include "IMVDefines.h"
|
|
#include "IMVApi.h"
|
|
#include<QMediaDevices>
|
|
#include<QMediaCaptureSession>
|
|
#include <QMediaRecorder>
|
|
#include <QImageCapture>
|
|
#include <QVideoWidget>
|
|
#include <QVideoSink>
|
|
#include <QtSql>
|
|
#include <QDataWidgetMapper>
|
|
#include <QSqlTableModel>
|
|
#include <QTableView>
|
|
#include "bachistoricalrecords.h"
|
|
#include "cammer.h"
|
|
#include <QSerialPort>
|
|
#include <QSerialPortInfo>
|
|
#include<QTimer>
|
|
#include <QMouseEvent>
|
|
#include <QPainter>
|
|
#include<QLabel>
|
|
#include<QListWidgetItem>
|
|
#include<QTableWidgetItem>
|
|
#include<QMessageBox>
|
|
#include "zidingyi.h"
|
|
#include "msgbox.h"
|
|
extern int count;
|
|
namespace Ui {
|
|
class bacteria;
|
|
}
|
|
|
|
class bacteria : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit bacteria(QWidget *parent = nullptr);
|
|
~bacteria();
|
|
HANDLE hthread;
|
|
|
|
bool issave=false;
|
|
|
|
void savezhao();
|
|
|
|
bool jixu=true;//用于取消时不再进行之后操作
|
|
public slots:
|
|
void getxinhao(QString p);
|
|
private slots:
|
|
void showtu();
|
|
void on_tableWidget_3_itemClicked(QTableWidgetItem *item);
|
|
void on_pushButton_clicked();
|
|
|
|
void on_pushButton_3_clicked();
|
|
|
|
|
|
|
|
void on_pushButton_4_clicked();
|
|
|
|
void on_pushButton_2_clicked();
|
|
|
|
void on_pushButton_5_clicked();
|
|
|
|
// void on_pushButton_6_clicked();
|
|
|
|
// void on_pushButton_7_clicked();
|
|
void getguan();
|
|
void getkai();
|
|
|
|
// void on_checkBox_clicked();
|
|
|
|
// void on_checkBox_2_clicked();
|
|
|
|
void on_horizontalSlider_valueChanged(int value);
|
|
|
|
void on_horizontalSlider_2_valueChanged(int value);
|
|
|
|
void on_horizontalSlider_5_valueChanged(int value);
|
|
|
|
void on_horizontalSlider_6_valueChanged(int value);
|
|
|
|
void on_horizontalSlider_7_valueChanged(int value);
|
|
|
|
void getming(QString s);
|
|
void on_pushButton_6_clicked();
|
|
|
|
void on_pushButton_7_clicked();
|
|
|
|
void on_pushButton_8_clicked();
|
|
|
|
void on_pushButton_9_clicked();
|
|
|
|
void on_pushButton_10_clicked();
|
|
|
|
void on_pushButton_11_clicked();
|
|
|
|
void on_pushButton_12_clicked();
|
|
|
|
void on_pushButton_13_clicked();
|
|
|
|
void on_pushButton_14_clicked();
|
|
|
|
private:
|
|
QString getProcessName(DWORD pid);
|
|
QList<DWORD> getProcessIdsByName(const QString& processName);
|
|
bool terminateProcess(pid_t pid) ;
|
|
// 停止标志位
|
|
bool stopFlag = false;
|
|
bool stopbreak = false;
|
|
void usepython();
|
|
void usepython_slow(QString yuan,QString jie);
|
|
void usepython_quick(QString yuan,QString jie);
|
|
QFuture<void> f;
|
|
|
|
zidingyi *m_zidingyi;
|
|
msgBox *m_msgBox;
|
|
int row=0;
|
|
QTimer *timer;
|
|
Ui::bacteria *ui;
|
|
IMV_HANDLE handle;
|
|
void drawOnLabelPixmap(QLabel* label, QPoint adjustedPos);
|
|
void drawOnLabelPixmap2(QLabel* label, QPoint adjustedPos);
|
|
QString getname();
|
|
QString gettime();
|
|
QCamera *Camera; //使用这个类,实例化出来,用指针接收
|
|
// QList<QCameraInfo> Infolist; //用于保存可用摄像头
|
|
// QCameraViewfinder *Viewfinder;
|
|
// QCameraImageCapture *ImageCapture;
|
|
QList<QCameraDevice> list_cameras;
|
|
QScopedPointer<QCamera> my_camera;
|
|
QScopedPointer<QMediaRecorder> my_mediaRecorder;
|
|
QMediaCaptureSession my_captureSession;
|
|
QImageCapture *imageCapture;
|
|
|
|
bool camera_state;
|
|
bachistoricalrecords *m_bachistoricalrecords;
|
|
|
|
QVideoWidget *w;
|
|
|
|
QTimer m_staticTimer;
|
|
cammer m_cammer;
|
|
QSerialPort SerialPort;
|
|
QList<QPoint> leftClickPoints;
|
|
QList<QPoint> rightClickPoints;
|
|
int x;
|
|
int y;
|
|
int gouxuan;
|
|
int a=0;
|
|
int radius=5 ;
|
|
|
|
void baocun();
|
|
bool eventFilterEnabled=true;
|
|
QString pix;//读取的照片路径
|
|
bool jishu;//确定是否要将本地照片进行计数
|
|
protected:
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
void wheelEvent(QWheelEvent *event) override ;
|
|
bool eventFilter(QObject *obj, QEvent *event){
|
|
|
|
if (!eventFilterEnabled) {
|
|
return QObject::eventFilter(obj, event);
|
|
}
|
|
|
|
// 只处理鼠标按下事件
|
|
if (event->type() == QEvent::MouseButtonPress) {
|
|
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
|
|
|
|
// 只允许处理左键点击
|
|
if (mouseEvent->button() == Qt::LeftButton||
|
|
mouseEvent->button() == Qt::RightButton) {
|
|
qDebug() << "点击事件被拦截";
|
|
|
|
return true; // 拦截非左键点击事件
|
|
} else {
|
|
qDebug() << "非点击事件正常";
|
|
|
|
return QObject::eventFilter(obj, event);
|
|
}
|
|
}
|
|
|
|
// 继续处理其他类型的事件
|
|
return QObject::eventFilter(obj, event);
|
|
}
|
|
signals:
|
|
void shuaxin();
|
|
void tuichu();
|
|
void show();
|
|
};
|
|
|
|
#endif // BACTERIA_H
|