mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2170 Summary Cross Plot : Show/hide toolbar based on active view
This commit is contained in:
parent
68bcd5253b
commit
a5b361f8c9
@ -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
|
||||
|
@ -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;
|
||||
|
@ -185,4 +185,26 @@ void PdmUiToolBarEditor::clear()
|
||||
m_actions.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiToolBarEditor::show()
|
||||
{
|
||||
if (m_toolbar)
|
||||
{
|
||||
m_toolbar->show();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiToolBarEditor::hide()
|
||||
{
|
||||
if (m_toolbar)
|
||||
{
|
||||
m_toolbar->hide();
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace caf
|
||||
|
@ -63,6 +63,9 @@ public:
|
||||
|
||||
void setFields(std::vector<caf::PdmFieldHandle*>& fields);
|
||||
void clear();
|
||||
|
||||
void show();
|
||||
void hide();
|
||||
|
||||
private:
|
||||
virtual void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||
|
Loading…
Reference in New Issue
Block a user