diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 839f09710e..b38d39fea6 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -114,11 +114,9 @@ void RimWellLogPlot::updateViewerWidget() { windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer); - RiuMainWindow::instance()->blockSubWindowActivatedSlot(true); RiuMainWindow::instance()->removeViewer(m_viewer); - RiuMainWindow::instance()->blockSubWindowActivatedSlot(false); - detachAllCurves(); + delete m_viewer; m_viewer = NULL; diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index ad384e3f13..53d449351f 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -1180,7 +1180,9 @@ QMdiSubWindow* RiuMainWindow::findMdiSubWindow(QWidget* viewer) //-------------------------------------------------------------------------------------------------- void RiuMainWindow::removeViewer(QWidget* viewer) { - m_mdiArea->removeSubWindow( findMdiSubWindow(viewer)); + m_blockSlotSubWindowActivated = true; + m_mdiArea->removeSubWindow(findMdiSubWindow(viewer)); + m_blockSlotSubWindowActivated = false; slotRefreshViewActions(); } @@ -1578,8 +1580,12 @@ void RiuMainWindow::slotEditPreferences() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::setActiveViewer(QWidget* viewer) { - QMdiSubWindow * swin = findMdiSubWindow(viewer); + m_blockSlotSubWindowActivated = true; + + QMdiSubWindow * swin = findMdiSubWindow(viewer); if (swin) m_mdiArea->setActiveSubWindow(swin); + + m_blockSlotSubWindowActivated = false; } //-------------------------------------------------------------------------------------------------- @@ -1680,9 +1686,7 @@ void RiuMainWindow::selectedObjectsChanged() // Set focus in MDI area to this window if it exists if (selectedReservoirView->viewer()) { - m_blockSlotSubWindowActivated = true; setActiveViewer(selectedReservoirView->viewer()->layoutWidget()); - m_blockSlotSubWindowActivated = false; } isActiveViewChanged = true; } @@ -1698,9 +1702,7 @@ void RiuMainWindow::selectedObjectsChanged() { if (selectedWellLogPlot->viewer()) { - m_blockSlotSubWindowActivated = true; setActiveViewer(selectedWellLogPlot->viewer()); - m_blockSlotSubWindowActivated = false; } isActiveViewChanged = true; @@ -2287,11 +2289,3 @@ bool RiuMainWindow::isAnyMdiSubWindowVisible() return m_mdiArea->subWindowList().size() > 0; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindow::blockSubWindowActivatedSlot(bool block) -{ - m_blockSlotSubWindowActivated = block; -} - diff --git a/ApplicationCode/UserInterface/RiuMainWindow.h b/ApplicationCode/UserInterface/RiuMainWindow.h index e68944df19..877f235f49 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.h +++ b/ApplicationCode/UserInterface/RiuMainWindow.h @@ -116,8 +116,6 @@ public: void tileWindows(); bool isAnyMdiSubWindowVisible(); - void blockSubWindowActivatedSlot(bool block); - protected: virtual void closeEvent(QCloseEvent* event);