diff --git a/kmplot/functioneditor.cpp b/kmplot/functioneditor.cpp --- a/kmplot/functioneditor.cpp +++ b/kmplot/functioneditor.cpp @@ -141,6 +141,7 @@ connect(XParser::self(), &XParser::functionAdded, this, &FunctionEditor::functionsChanged); connect(XParser::self(), &XParser::functionRemoved, this, &FunctionEditor::functionsChanged); + connect(XParser::self(), &XParser::functionRemoved, View::self(), &View::functionRemoved); m_editor->createNewPlot->setMenu( createNewPlotsMenu ); diff --git a/kmplot/view.h b/kmplot/view.h --- a/kmplot/view.h +++ b/kmplot/view.h @@ -211,6 +211,8 @@ /// Called when the graph should be updated void drawPlot(); + /// Called when a function is deleted + void functionRemoved( int id ); ///Slots for the three first items in popup menu void hideCurrentFunction(); void removeCurrentPlot(); diff --git a/kmplot/view.cpp b/kmplot/view.cpp --- a/kmplot/view.cpp +++ b/kmplot/view.cpp @@ -120,6 +120,7 @@ m_sliderWindow = 0; m_popupMenuTitle = m_popupMenu->insertSection( MainDlg::self()->m_firstFunctionAction, "" ); + connect(XParser::self(), &XParser::functionRemoved, this, &View::functionRemoved); } @@ -3969,6 +3970,16 @@ m_menuSliderAction->setChecked( false ); //set the slider-item in the menu } +void View::functionRemoved( int id ) +{ + if ( id == m_currentPlot.functionID() ) + { + m_currentPlot.setFunctionID( -1 ); + setStatusBar( QString(), RootSection ); + setStatusBar( QString(), FunctionSection ); + } +} + void View::hideCurrentFunction() { if ( m_currentPlot.functionID() == -1 )