mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2178 Summary Curve Edit : Create autoname for plot when possible
This commit is contained in:
parent
1bd0de318f
commit
128f2eaee7
@ -643,18 +643,38 @@ void RicSummaryCurveCreator::createNewPlot()
|
||||
RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection();
|
||||
if (summaryPlotColl)
|
||||
{
|
||||
QString summaryPlotName = QString("Summary Plot %1").arg(summaryPlotColl->summaryPlots().size() + 1);
|
||||
|
||||
bool ok = false;
|
||||
summaryPlotName = QInputDialog::getText(NULL, "New Summary Plot Name", "New Summary Plot Name", QLineEdit::Normal, summaryPlotName, &ok);
|
||||
if (ok)
|
||||
QString candidatePlotName;
|
||||
if (m_previewPlot)
|
||||
{
|
||||
RimSummaryPlot* plot = summaryPlotColl->createNamedSummaryPlot(summaryPlotName);
|
||||
plot->loadDataAndUpdate();
|
||||
candidatePlotName = m_previewPlot->summaryCurveCollection()->compileAutoPlotTitle();
|
||||
}
|
||||
|
||||
RimSummaryPlot* newSummaryPlot = nullptr;
|
||||
|
||||
if (candidatePlotName.isEmpty())
|
||||
{
|
||||
candidatePlotName = QString("Summary Plot %1").arg(summaryPlotColl->summaryPlots().size() + 1);
|
||||
bool ok = false;
|
||||
candidatePlotName = QInputDialog::getText(NULL, "New Summary Plot Name", "New Summary Plot Name", QLineEdit::Normal, candidatePlotName, &ok);
|
||||
if (!ok)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
newSummaryPlot = summaryPlotColl->createNamedSummaryPlot(candidatePlotName);
|
||||
}
|
||||
else
|
||||
{
|
||||
newSummaryPlot = summaryPlotColl->createSummaryPlotAutoName();
|
||||
}
|
||||
|
||||
if (newSummaryPlot)
|
||||
{
|
||||
newSummaryPlot->loadDataAndUpdate();
|
||||
|
||||
summaryPlotColl->updateConnectedEditors();
|
||||
|
||||
m_targetPlot = plot;
|
||||
m_targetPlot = newSummaryPlot;
|
||||
updateTargetPlot();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user