From b1a419962f38ca943ac1e0377c4400980a152442 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <svechnikovmv@gmail.com>
Date: Wed, 8 Feb 2023 15:34:47 +0100
Subject: [PATCH] IntensityDataProjectionsWidget: fix switching between data in
 projection mode

---
 GUI/View/Projection/IntensityDataProjectionsWidget.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/GUI/View/Projection/IntensityDataProjectionsWidget.cpp b/GUI/View/Projection/IntensityDataProjectionsWidget.cpp
index 92afe6feb2c..897a0787fcd 100644
--- a/GUI/View/Projection/IntensityDataProjectionsWidget.cpp
+++ b/GUI/View/Projection/IntensityDataProjectionsWidget.cpp
@@ -79,6 +79,11 @@ void IntensityDataProjectionsWidget::setContext()
     m_selectionModel.reset(new QItemSelectionModel(containerModel));
 
     m_projectionsCanvas->setSelectionModel(m_selectionModel.get());
+
+    // The following line must come before 'm_projectionsCanvas->setContext()'!
+    // It prevents problem with switching between datasets in projectoin mode.
+    m_projectionsWidget->disconnectItem();
+
     m_projectionsCanvas->setContext(currentIntensityDataItem());
     m_projectionsWidget->setIntensityItem(currentIntensityDataItem());
 
-- 
GitLab