Commit 3436836e authored by CABEL Tristan's avatar CABEL Tristan

plot2d unselect all items on save/remove buttons activation

parent 776ac3e4
......@@ -173,6 +173,11 @@ dtkVisualizationPlot2D::dtkVisualizationPlot2D(QWidget *parent) : dtkVisualizati
d->remove_field->setChecked(false);
QGuiApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
if(checked) {
//unselect items
QList<QListWidgetItem *> l = d->field_y->selectedItems();
for(auto *i: l)
i->setSelected(false);
QGuiApplication::setOverrideCursor(QCursor(Qt::PointingHandCursor));
this->hud()->addInfo("Select a field or press 'Escape'");
}
......@@ -183,6 +188,10 @@ dtkVisualizationPlot2D::dtkVisualizationPlot2D(QWidget *parent) : dtkVisualizati
d->save_field->setChecked(false);
QGuiApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
if(checked) {
QList<QListWidgetItem *> l = d->field_y->selectedItems();
for(auto *i: l)
i->setSelected(false);
QGuiApplication::setOverrideCursor(QCursor(Qt::PointingHandCursor));
this->hud()->addInfo("Select a field or press 'Escape'");
}
......@@ -276,9 +285,8 @@ dtkVisualizationPlot2D::dtkVisualizationPlot2D(QWidget *parent) : dtkVisualizati
new_name = QString(arr->GetName() + d->add_plot_suffix);
}
d->old_fields_param.insert(new_name, d->fields_parameters[row_text]);
if(!d->old_fields->HasArray(new_name.toStdString().c_str())) {
d->old_fields_param.insert(new_name, d->fields_parameters[row_text]);
vtkSmartPointer<vtkDoubleArray> new_field = vtkSmartPointer<vtkDoubleArray>::New();
new_field->DeepCopy(arr);
new_field->SetName(new_name.toStdString().c_str()) ;
......@@ -597,8 +605,23 @@ void dtkVisualizationPlot2D::removeField(const QString& field)
d->field_x->removeItem(idx);
}
// QList<int> rows_to_delete;
// for(int i=0; i < d->field_y->count(); ++i) {
// if(d->field_y->item(i)->text() == field)
// rows_to_delete << i;
// }
// for(int row : rows_to_delete) {
// auto *item = d->field_y->takeItem(row);
// delete item;
// }
qDeleteAll(d->field_y->findItems(field, Qt::MatchFixedString));
d->fields_parameters.remove(field);
d->old_fields->RemoveArray(field.toStdString().c_str());
d->old_fields_param.remove(field);
d->fields_table->RemoveColumnByName(field.toStdString().c_str());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment