소스 검색

添加析构函数的相机解绑

yun 2 주 전
부모
커밋
eb9135c239

+ 8 - 1
View/die-bonder-ui/OriginalWnd/ChartsAndCamerasWnd.cpp

@@ -75,6 +75,7 @@ ChartsAndCamerasWnd::~ChartsAndCamerasWnd()
 {
     m_pMainCameraBind = nullptr;
     delete ui;
+    UnCameraBind();
 }
 
 
@@ -331,6 +332,12 @@ void ChartsAndCamerasWnd::UnCameraBind()
     {
         CameraConnectUpdateImageFun(i, m_allGroup[i], true);
     }
+    //判断退出前的窗口是否是绑定相机
+    if (m_veCurrentSelectGroup.isBond == true) {
+        //解绑
+        disconnect(m_veCurrentSelectGroup.pSelectGroup, &Group::SetUpDataImageShowSig,
+            this, &ChartsAndCamerasWnd::GetGroupImageShowSignals);
+    }
 }
 
 void ChartsAndCamerasWnd::UpdateCameraDisplay0(int iCameraId, JVision::ImageInfo imageData)
@@ -375,7 +382,7 @@ void ChartsAndCamerasWnd::CameraConnectUpdateImageFun(int nIndex, Group* widget,
         else
         {
             //共用函数
-            connect(widget, &Group::sendUpdateGroupState, this, &ChartsAndCamerasWnd::checkSettings);
+            //connect(widget, &Group::sendUpdateGroupState, this, &ChartsAndCamerasWnd::checkSettings);
             connect(this, pCamerasImage, widget, &Group::UpDataImageShowSlots);
         }
 

+ 13 - 2
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.cpp

@@ -168,13 +168,12 @@ void MainAndSecondaryCamerasWnd::CameraConnectUpdateImageFun(int nIndex, Group*
     {
         if (isUnCameraBind)
         {
-            disconnect(widget, &Group::SetCurrentSelectSig, this, &MainAndSecondaryCamerasWnd::GetCurrentSelectSlots);
+            //disconnect(widget, &Group::SetCurrentSelectSig, this, &MainAndSecondaryCamerasWnd::GetCurrentSelectSlots);
             disconnect(this, pCamerasImage, widget, &Group::UpDataImageShowSlots);
         }
         else
         {
             //共用函数
-            //connect(widget, &Group::send_button_Signal, this, &MainAndSecondaryCamerasWnd::CheckIs);
             // connect(widget, &Group::SetCurrentSelectSig, this, &MainAndSecondaryCamerasWnd::GetCurrentSelectSlots);
             connect(this, pCamerasImage, widget, &Group::UpDataImageShowSlots);
         }
@@ -387,6 +386,18 @@ void MainAndSecondaryCamerasWnd::UnCameraBind()
     {
         CameraConnectUpdateImageFun(i, m_allGroup[i], true);
     }
+    //判断更新前的左窗口是否是绑定相机
+    if (m_veCurrentSelectGroup_L.isBond == true) {
+        disconnect(m_veCurrentSelectGroup_L.pSelectGroup, &Group::SetUpDataImageShowSig,
+            this, &MainAndSecondaryCamerasWnd::GetGroupImageShowSignalsTo_L);
+    }
+
+    //判断更新前的右窗口是否是绑定相机
+    if (m_veCurrentSelectGroup_R.isBond == true) {
+        //解绑
+        disconnect(m_veCurrentSelectGroup_R.pSelectGroup, &Group::SetUpDataImageShowSig,
+            this, &MainAndSecondaryCamerasWnd::GetGroupImageShowSignalsTo_R);
+    }
 }
 
 void MainAndSecondaryCamerasWnd::UpdateCameraDisplay0(int iCameraId, JVision::ImageInfo imageData)

+ 11 - 2
View/die-bonder-ui/OriginalWnd/SingleCameraOperationWnd.cpp

@@ -23,6 +23,9 @@ SingleCameraOperationWnd::SingleCameraOperationWnd(QWidget* parent)
 SingleCameraOperationWnd::~SingleCameraOperationWnd()
 {
     delete ui;
+    UnCameraBind();
+
+
 }
 
 void SingleCameraOperationWnd::initFrom() {
@@ -142,6 +145,12 @@ void SingleCameraOperationWnd::UnCameraBind()
     {
         CameraConnectUpdateImageFun(i, m_allGroup[i], true);
     }
+    //判断退出前的窗口是否是绑定相机
+    if (m_veCurrentSelectGroup.isBond == true) {
+        //解绑
+        disconnect(m_veCurrentSelectGroup.pSelectGroup, &Group::SetUpDataImageShowSig,
+            this, &SingleCameraOperationWnd::GetGroupImageShowSignals);
+    }
 }
 
 void SingleCameraOperationWnd::CameraConnectUpdateImageFun(int nIndex, Group* widget, bool isUnCameraBind /*= false*/)
@@ -150,13 +159,13 @@ void SingleCameraOperationWnd::CameraConnectUpdateImageFun(int nIndex, Group* wi
     {
         if (isUnCameraBind)
         {
-            disconnect(widget, &Group::SetCurrentSelectSig, this, &SingleCameraOperationWnd::checkSettings);
+           // disconnect(widget, &Group::SetCurrentSelectSig, this, &SingleCameraOperationWnd::checkSettings);
             disconnect(this, pCamerasImage, widget, &Group::UpDataImageShowSlots);
         }
         else
         {
             //共用函数
-            connect(widget, &Group::sendUpdateGroupState, this, &SingleCameraOperationWnd::checkSettings);
+            //connect(widget, &Group::sendUpdateGroupState, this, &SingleCameraOperationWnd::checkSettings);
             connect(this, pCamerasImage, widget, &Group::UpDataImageShowSlots);
         }