Skip to content
Snippets Groups Projects
Commit e9567252 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Still fighting with bug in ParameterTUningWidget because of its Time of life.

parent 75d7835a
No related branches found
No related tags found
No related merge requests found
......@@ -103,8 +103,8 @@ ParameterTuningDelegate::ParameterTuningDelegate(QObject *parent)
ParameterTuningDelegate::~ParameterTuningDelegate()
{
if(m_currentItem)
m_currentItem->mapper()->unsubscribe(this);
// if(m_currentItem)
// m_currentItem->mapper()->unsubscribe(this);
}
......@@ -195,15 +195,16 @@ QWidget *ParameterTuningDelegate::createEditor(QWidget *parent,
m_contentLayout->addWidget(m_valueBox);
m_contentLayout->addWidget(m_slider);
m_currentItem->mapper()->setOnValueChange(
[this](){
m_valueBox->setValue(m_currentItem->value().toDouble());
}, this);
// FIXME there is an issue with time of life of editor .vs. item
// m_currentItem->mapper()->setOnValueChange(
// [this](){
// m_valueBox->setValue(m_currentItem->value().toDouble());
// }, this);
m_currentItem->mapper()->setOnItemDestroy(
[this](SessionItem *) {
m_currentItem = 0;
}, this);
// m_currentItem->mapper()->setOnItemDestroy(
// [this](SessionItem *) {
// m_currentItem = 0;
// }, this);
m_contentWidget->setLayout(m_contentLayout);
......
......@@ -202,6 +202,8 @@ void ParameterTuningWidget::restoreModelsOfCurrentJobItem()
if(m_currentJobItem->isRunning())
return;
closeActiveEditors();
m_jobModel->restore(m_currentJobItem);
m_jobModel->runJob(m_currentJobItem->index());
}
......@@ -299,13 +301,18 @@ void ParameterTuningWidget::setTuningDelegateEnabled(bool enabled)
} else {
m_delegate->setReadOnly(true);
QModelIndex index = m_treeView->currentIndex();
QWidget *editor = m_treeView->indexWidget(index);
if(editor) {
//m_delegate->commitData(editor);
m_delegate->closeEditor(editor, QAbstractItemDelegate::NoHint);
}
m_treeView->selectionModel()->clearSelection();
closeActiveEditors();
}
}
void ParameterTuningWidget::closeActiveEditors()
{
QModelIndex index = m_treeView->currentIndex();
QWidget *editor = m_treeView->indexWidget(index);
if(editor) {
//m_delegate->commitData(editor);
m_delegate->closeEditor(editor, QAbstractItemDelegate::NoHint);
}
m_treeView->selectionModel()->clearSelection();
}
......@@ -68,6 +68,7 @@ private:
void updateDragAndDropSettings();
void setTuningDelegateEnabled(bool enabled);
void closeActiveEditors();
JobModel *m_jobModel;
JobItem *m_currentJobItem;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment