diff --git a/kmplot/functioneditor.h b/kmplot/functioneditor.h --- a/kmplot/functioneditor.h +++ b/kmplot/functioneditor.h @@ -95,6 +95,10 @@ */ void save(); /** + * Called when the user ticks or unticks an item in the function list. + */ + void saveItem(QListWidgetItem *item); + /** * Updates the list of functions (called when a function is added or * removed from Parser). */ diff --git a/kmplot/functioneditor.cpp b/kmplot/functioneditor.cpp --- a/kmplot/functioneditor.cpp +++ b/kmplot/functioneditor.cpp @@ -117,7 +117,7 @@ connect(m_editor->deleteButton, &QPushButton::clicked, this, &FunctionEditor::deleteCurrent); connect(m_functionList, &FunctionListWidget::currentItemChanged, this, &FunctionEditor::functionSelected); - connect(m_functionList, &FunctionListWidget::itemClicked, this, &FunctionEditor::save); + connect(m_functionList, &FunctionListWidget::itemClicked, this, &FunctionEditor::saveItem); //BEGIN connect up all editing widgets #define CONNECT_WIDGETS( name, signal ) \ @@ -544,6 +544,22 @@ m_saveTimer[ f->type() ]->start( 0 ); } +void FunctionEditor::saveItem(QListWidgetItem *item) +{ + if (item != m_functionList->currentItem()) + { + m_functionList->setCurrentItem(item); + if (item->checkState() == Qt::Checked) + { + item->setCheckState(Qt::Unchecked); + } else + { + item->setCheckState(Qt::Checked); + } + } + + save(); +} void FunctionEditor::saveCartesian() {