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/parser.cpp b/kmplot/parser.cpp --- a/kmplot/parser.cpp +++ b/kmplot/parser.cpp @@ -28,6 +28,7 @@ #include "parser.h" #include "parseradaptor.h" #include "settings.h" +#include "view.h" #include "xparser.h" //KDE includes @@ -695,10 +696,17 @@ if ( answer == KMessageBox::Cancel ) return false; } - + + int currentFunctionID = View::self()->m_currentPlot.functionID(); foreach ( Function *f, toRemove ) { uint id = f->id(); + // Disable trace mode if trace mode is enabled and reset statusbar + if ( (int)id == currentFunctionID ) + { + View::self()->m_currentPlot.setFunctionID( -1 ); + View::self()->resetStatusBar(); + } m_ufkt.remove( id ); delete f; emit functionRemoved( id ); 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 @@ -3969,6 +3969,16 @@ m_menuSliderAction->setChecked( false ); //set the slider-item in the menu } +void View::functionRemoved( int id ) +{ + if ( (int)id == m_currentPlot.functionID() ) + { + m_currentPlot.setFunctionID( -1 ); + setStatusBar( QString(), RootSection ); + setStatusBar( QString(), FunctionSection ); + } +} + void View::hideCurrentFunction() { if ( m_currentPlot.functionID() == -1 )