mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#493) Correct handling of MDI sub window activation.
Setting bool member variable that blocks sub window activation slot temporarily at the correct places - the main window methods that sets active viewer and removes a viewer.
This commit is contained in:
parent
5e8a6d90cd
commit
c32f4cabfe
@ -114,11 +114,9 @@ void RimWellLogPlot::updateViewerWidget()
|
|||||||
{
|
{
|
||||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer);
|
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer);
|
||||||
|
|
||||||
RiuMainWindow::instance()->blockSubWindowActivatedSlot(true);
|
|
||||||
RiuMainWindow::instance()->removeViewer(m_viewer);
|
RiuMainWindow::instance()->removeViewer(m_viewer);
|
||||||
RiuMainWindow::instance()->blockSubWindowActivatedSlot(false);
|
|
||||||
|
|
||||||
detachAllCurves();
|
detachAllCurves();
|
||||||
|
|
||||||
delete m_viewer;
|
delete m_viewer;
|
||||||
m_viewer = NULL;
|
m_viewer = NULL;
|
||||||
|
|
||||||
|
@ -1180,7 +1180,9 @@ QMdiSubWindow* RiuMainWindow::findMdiSubWindow(QWidget* viewer)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuMainWindow::removeViewer(QWidget* viewer)
|
void RiuMainWindow::removeViewer(QWidget* viewer)
|
||||||
{
|
{
|
||||||
m_mdiArea->removeSubWindow( findMdiSubWindow(viewer));
|
m_blockSlotSubWindowActivated = true;
|
||||||
|
m_mdiArea->removeSubWindow(findMdiSubWindow(viewer));
|
||||||
|
m_blockSlotSubWindowActivated = false;
|
||||||
|
|
||||||
slotRefreshViewActions();
|
slotRefreshViewActions();
|
||||||
}
|
}
|
||||||
@ -1578,8 +1580,12 @@ void RiuMainWindow::slotEditPreferences()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuMainWindow::setActiveViewer(QWidget* viewer)
|
void RiuMainWindow::setActiveViewer(QWidget* viewer)
|
||||||
{
|
{
|
||||||
|
m_blockSlotSubWindowActivated = true;
|
||||||
|
|
||||||
QMdiSubWindow * swin = findMdiSubWindow(viewer);
|
QMdiSubWindow * swin = findMdiSubWindow(viewer);
|
||||||
if (swin) m_mdiArea->setActiveSubWindow(swin);
|
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
|
// Set focus in MDI area to this window if it exists
|
||||||
if (selectedReservoirView->viewer())
|
if (selectedReservoirView->viewer())
|
||||||
{
|
{
|
||||||
m_blockSlotSubWindowActivated = true;
|
|
||||||
setActiveViewer(selectedReservoirView->viewer()->layoutWidget());
|
setActiveViewer(selectedReservoirView->viewer()->layoutWidget());
|
||||||
m_blockSlotSubWindowActivated = false;
|
|
||||||
}
|
}
|
||||||
isActiveViewChanged = true;
|
isActiveViewChanged = true;
|
||||||
}
|
}
|
||||||
@ -1698,9 +1702,7 @@ void RiuMainWindow::selectedObjectsChanged()
|
|||||||
{
|
{
|
||||||
if (selectedWellLogPlot->viewer())
|
if (selectedWellLogPlot->viewer())
|
||||||
{
|
{
|
||||||
m_blockSlotSubWindowActivated = true;
|
|
||||||
setActiveViewer(selectedWellLogPlot->viewer());
|
setActiveViewer(selectedWellLogPlot->viewer());
|
||||||
m_blockSlotSubWindowActivated = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
isActiveViewChanged = true;
|
isActiveViewChanged = true;
|
||||||
@ -2287,11 +2289,3 @@ bool RiuMainWindow::isAnyMdiSubWindowVisible()
|
|||||||
return m_mdiArea->subWindowList().size() > 0;
|
return m_mdiArea->subWindowList().size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RiuMainWindow::blockSubWindowActivatedSlot(bool block)
|
|
||||||
{
|
|
||||||
m_blockSlotSubWindowActivated = block;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -116,8 +116,6 @@ public:
|
|||||||
void tileWindows();
|
void tileWindows();
|
||||||
bool isAnyMdiSubWindowVisible();
|
bool isAnyMdiSubWindowVisible();
|
||||||
|
|
||||||
void blockSubWindowActivatedSlot(bool block);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent* event);
|
virtual void closeEvent(QCloseEvent* event);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user