mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1912 Curve Creator : Avoid selection in main project tree when clicking on curve
This commit is contained in:
parent
184e00c5aa
commit
802a9154e4
@ -29,6 +29,8 @@
|
||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "cafPdmUiTreeViewEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryCurveCollection, "RimSummaryCurveCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -109,7 +111,6 @@ void RimSummaryCurveCollection::detachQwtCurves()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -186,6 +187,7 @@ void RimSummaryCurveCollection::deleteCurvesAssosiatedWithCase(RimSummaryCase* s
|
||||
m_curves.removeChildObject(summaryCurve);
|
||||
delete summaryCurve;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -212,10 +214,32 @@ void RimSummaryCurveCollection::updateCaseNameHasChanged()
|
||||
if (parentPlot->qwtPlot()) parentPlot->qwtPlot()->updateLegend();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveCollection::setCurrentSummaryCurve(RimSummaryCurve* curve)
|
||||
{
|
||||
m_currentSummaryCurve = curve;
|
||||
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimSummaryCurveCollection::objectToggleField()
|
||||
{
|
||||
return &m_showCurves;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveCollection::defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
caf::PdmUiTreeViewEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTreeViewEditorAttribute*>(attribute);
|
||||
if (myAttr && m_currentSummaryCurve.notNull())
|
||||
{
|
||||
myAttr->currentObject = m_currentSummaryCurve.p();
|
||||
}
|
||||
}
|
||||
|
@ -57,9 +57,12 @@ public:
|
||||
void deleteAllCurves();
|
||||
void updateCaseNameHasChanged();
|
||||
|
||||
void setCurrentSummaryCurve(RimSummaryCurve* curve);
|
||||
|
||||
private:
|
||||
caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
virtual void defineObjectEditorAttribute(QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute) override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrArrayField<RimSummaryCase*> m_selectedSummaryCases;
|
||||
@ -67,5 +70,6 @@ private:
|
||||
caf::PdmField<bool> m_showCurves;
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
|
||||
|
||||
caf::PdmPointer<RimSummaryCurve> m_currentSummaryCurve;
|
||||
};
|
||||
|
||||
|
@ -1320,7 +1320,13 @@ caf::PdmObject* RimSummaryPlot::findRimCurveFromQwtCurve(const QwtPlotCurve* qwt
|
||||
if (m_summaryCurveCollection)
|
||||
{
|
||||
RimSummaryCurve* foundCurve = m_summaryCurveCollection->findRimCurveFromQwtCurve(qwtCurve);
|
||||
if (foundCurve) return foundCurve;
|
||||
|
||||
if (foundCurve)
|
||||
{
|
||||
m_summaryCurveCollection->setCurrentSummaryCurve(foundCurve);
|
||||
|
||||
return foundCurve;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
@ -316,8 +317,6 @@ bool RiuSummaryQwtPlot::eventFilter(QObject* watched, QEvent* event)
|
||||
return QwtPlot::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -345,7 +344,11 @@ void RiuSummaryQwtPlot::selectClosestCurve(const QPoint& pos)
|
||||
if(closestCurve && distMin < 20)
|
||||
{
|
||||
caf::PdmObject* selectedCurve = m_plotDefinition->findRimCurveFromQwtCurve(closestCurve);
|
||||
if(selectedCurve)
|
||||
|
||||
RimProject* proj = nullptr;
|
||||
selectedCurve->firstAncestorOrThisOfType(proj);
|
||||
|
||||
if(proj && selectedCurve)
|
||||
{
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(selectedCurve);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user