Skip to content
Snippets Groups Projects
Commit e127207e authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

conditional subscription for axes panels

parent ab4b3317
No related branches found
No related tags found
1 merge request!2763Fix axes and add hide mask-related actions from sim/job
......@@ -17,6 +17,7 @@
#include "GUI/Model/Axis/AmplitudeAxisItem.h"
#include "GUI/Model/Data/Data2DItem.h"
#include "GUI/Model/File/DatafilesSet.h"
#include "GUI/Model/Job/JobsSet.h"
#include "GUI/Model/Project/DataSource.h"
#include "GUI/Model/Project/ProjectDocument.h"
#include "GUI/View/Numeric/NumWidgetUtil.h"
......@@ -168,7 +169,15 @@ AxesPanel::AxesPanel(const DataSource* ds)
layout->addRow(zGroup);
connect(gDoc->datafiles(), &DatafilesSet::setChanged, this, &AxesPanel::updatePanel);
// subscription type depends on the context
if (dynamic_cast<const DataFromData*>(m_data_source))
connect(gDoc->datafiles(), &DatafilesSet::setChanged, this, &AxesPanel::updatePanel);
else if (dynamic_cast<const DataFromSim*>(m_data_source)
|| dynamic_cast<const DataFromJob*>(m_data_source))
connect(gDoc->jobs(), &JobsSet::jobPlotContextChanged, this, &AxesPanel::updatePanel);
else
ASSERT_NEVER;
updatePanel();
}
......
......@@ -19,6 +19,7 @@
#include "GUI/Model/Data/Data1DItem.h"
#include "GUI/Model/Data/DataItem.h"
#include "GUI/Model/File/DatafilesSet.h"
#include "GUI/Model/Job/JobsSet.h"
#include "GUI/Model/Project/DataSource.h"
#include "GUI/Model/Project/ProjectDocument.h"
#include "GUI/View/Base/LayoutUtil.h"
......@@ -121,7 +122,15 @@ AxisPanel::AxisPanel(const DataSource* ds)
main_layout->addRow(yGroup);
connect(gDoc->datafiles(), &DatafilesSet::setChanged, this, &AxisPanel::updatePanel);
// subscription type depends on the context
if (dynamic_cast<const DataFromData*>(m_data_source))
connect(gDoc->datafiles(), &DatafilesSet::setChanged, this, &AxisPanel::updatePanel);
else if (dynamic_cast<const DataFromSim*>(m_data_source)
|| dynamic_cast<const DataFromJob*>(m_data_source))
connect(gDoc->jobs(), &JobsSet::jobPlotContextChanged, this, &AxisPanel::updatePanel);
else
ASSERT_NEVER;
updatePanel();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment