Skip to content

Commit

Permalink
GraphPanel widget: improved our removeAllGraphPanels() method (openco…
Browse files Browse the repository at this point in the history
…r#1426).

Indeed, until now, we were removing all the graph panels, but the first
one. This was not only arbitrary, but if the graph panel had been
customised (e.g., a title had been set), then it means that it would
still be there. So, now, we add a graph panel (since we need at least
one graph panel) and then really remove all the other graph panels.
  • Loading branch information
agarny committed Nov 14, 2017
1 parent 8c1643a commit 8082eff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Expand Up @@ -2435,8 +2435,7 @@ bool SimulationExperimentViewSimulationWidget::furtherInitialize()

GraphPanelWidget::GraphPanelsWidget *graphPanelsWidget = mContentsWidget->graphPanelsWidget();

while (graphPanelsWidget->graphPanels().count() != 1)
graphPanelsWidget->removeCurrentGraphPanel();
graphPanelsWidget->removeAllGraphPanels();

// Add some graph panels, so that their number corresponds to the number of
// 2D outputs mentioned in the SED-ML file, and select the first one
Expand Down
12 changes: 4 additions & 8 deletions src/plugins/widget/GraphPanelWidget/src/graphpanelswidget.cpp
Expand Up @@ -291,17 +291,13 @@ bool GraphPanelsWidget::removeCurrentGraphPanel()

void GraphPanelsWidget::removeAllGraphPanels()
{
// Make sure that we don't have only one graph panel left

if (mGraphPanels.count() == 1)
return;
// Remove all the graph panels, after having created an 'empty' one (since
// we want at least one graph panel at any given point in time)

// Remove all the graph panels but one
// Note: the one we keep is the very first one since it may be the user's
// most important graph panel...
addGraphPanel();

while (mGraphPanels.count() > 1)
removeGraphPanel(mGraphPanels.last());
removeGraphPanel(mGraphPanels.first());
}

//==============================================================================
Expand Down

0 comments on commit 8082eff

Please sign in to comment.