Browse Source

add the stop function about livebutton

Change-Id: I4595b61e239eba4445a9cc7d9102d43be26721a3
ren_chaolun* 1 month ago
parent
commit
8c6b4f4405
2 changed files with 13 additions and 1 deletions
  1. 11 1
      OriginalWnd/SingleCameraOperationWnd.cpp
  2. 2 0
      OriginalWnd/SingleCameraOperationWnd.h

+ 11 - 1
OriginalWnd/SingleCameraOperationWnd.cpp

@@ -13,6 +13,7 @@ SingleCameraOperationWnd::SingleCameraOperationWnd(QWidget *parent)
 {
     ui->setupUi(this);
     isShow = true;
+    liveClick = true;
     initFrom();
 }
 
@@ -500,6 +501,9 @@ void SingleCameraOperationWnd::startCamera(int cameraId) {
     m_grabber->start();
 }
 
+void SingleCameraOperationWnd::stopCamera(int cameraId){
+    m_grabber->stop();
+}
 void SingleCameraOperationWnd::on_DatacomboBox_currentIndexChanged(int index){
     QSettings settings("YourCompany", "YourApplication_");
     int groupId = settings.value("GroupId", 0).toInt();
@@ -531,5 +535,11 @@ void SingleCameraOperationWnd::updateImage(const QImage&image){
 }
 
 void SingleCameraOperationWnd::loadLiveVedio(){
-    startCamera(0);
+    if(liveClick == true){
+        startCamera(0);
+        liveClick = false;
+    }else{
+        stopCamera(0);
+        liveClick = true;
+    }
 }

+ 2 - 0
OriginalWnd/SingleCameraOperationWnd.h

@@ -38,6 +38,7 @@ public:
     void WaffleWidget(); // 华夫盒
     void MaterialBoxWidget(); // 料盒
 	void startCamera(int cameraId);
+    void stopCamera(int cameraId);
     void updateImage(const QImage&image);
 public slots: // 确保这里声明了槽函数
     void onComboBoxIndexChanged(int index); // 确保签名匹配
@@ -79,6 +80,7 @@ private:
     ImageGrabber *m_grabber;
     QMap<int, Group*> groupMap;
     int currentCameraId;
+    bool liveClick;
 };
 
 #endif // SINGLECAMERAOPERATIONWND_H