#2170 Summary Cross Plot : Show/hide toolbar based on active view

This commit is contained in:
Magne Sjaastad
2017-12-01 13:55:36 +01:00
parent 68bcd5253b
commit a5b361f8c9
4 changed files with 47 additions and 16 deletions

View File

@@ -121,7 +121,7 @@ void RiuMainPlotWindow::cleanupGuiBeforeProjectClose()
cleanUpTemporaryWidgets();
m_summaryPlotToolBar->clear();
m_summaryPlotToolBarEditor->clear();
setWindowTitle("Plots - ResInsight");
}
@@ -307,7 +307,8 @@ void RiuMainPlotWindow::createToolBars()
}
}
m_summaryPlotToolBar = new caf::PdmUiToolBarEditor("Summary Plot", this);
m_summaryPlotToolBarEditor = new caf::PdmUiToolBarEditor("Summary Plot", this);
m_summaryPlotToolBarEditor->hide();
}
//--------------------------------------------------------------------------------------------------
@@ -525,6 +526,24 @@ void RiuMainPlotWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
m_activePlotViewWindow = viewWindow;
}
RimSummaryPlot* summaryPlot = dynamic_cast<RimSummaryPlot*>(viewWindow);
if (summaryPlot)
{
std::vector<caf::PdmFieldHandle*> toolBarFields;
toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar();
m_summaryPlotToolBarEditor->setFields(toolBarFields);
m_summaryPlotToolBarEditor->updateUi();
m_summaryPlotToolBarEditor->show();
}
else
{
m_summaryPlotToolBarEditor->clear();
m_summaryPlotToolBarEditor->hide();
}
}
//--------------------------------------------------------------------------------------------------
@@ -598,19 +617,6 @@ void RiuMainPlotWindow::selectedObjectsChanged()
}
m_pdmUiPropertyView->showProperties(firstSelectedObject);
std::vector<caf::PdmFieldHandle*> toolBarFields;
if (firstSelectedObject)
{
RimSummaryPlot* summaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType(summaryPlot);
if (summaryPlot)
{
toolBarFields = summaryPlot->summaryCurveCollection()->fieldsToShowInToolbar();
}
}
m_summaryPlotToolBar->setFields(toolBarFields);
m_summaryPlotToolBar->updateUi();
if (uiItems.size() == 1)
{
// Find the reservoir view or the Plot that the selected item is within

View File

@@ -119,7 +119,7 @@ private:
QMenu* m_windowMenu;
caf::PdmUiTreeView* m_projectTreeView;
caf::PdmUiToolBarEditor* m_summaryPlotToolBar;
caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor;
std::unique_ptr<caf::PdmUiDragDropInterface> m_dragDropInterface;
caf::PdmUiPropertyView* m_pdmUiPropertyView;