change deletion order in parameter editor to avoid that a parameter group isn't deleted

This commit is contained in:
wmayer
2019-10-18 15:46:02 +02:00
parent 81b615bfb9
commit ee912a5f16

View File

@@ -404,16 +404,21 @@ void ParameterGroup::onDeleteSelectedItem()
QTreeWidgetItem* sel = currentItem();
if (isItemSelected(sel) && sel->parent())
{
if ( QMessageBox::question(this, tr("Remove group"), tr("Do really want to remove this parameter group?"),
if ( QMessageBox::question(this, tr("Remove group"), tr("Do you really want to remove this parameter group?"),
QMessageBox::Yes, QMessageBox::No|QMessageBox::Default|QMessageBox::Escape) ==
QMessageBox::Yes )
{
QTreeWidgetItem* parent = sel->parent();
int index = parent->indexOfChild(sel);
parent->takeChild(index);
ParameterGroupItem* para = static_cast<ParameterGroupItem*>(parent);
para->_hcGrp->RemoveGrp(sel->text(0).toLatin1());
std::string groupName = sel->text(0).toLatin1();
// must delete the tree item here because it and its children still
// hold a reference to the parameter group
delete sel;
ParameterGroupItem* para = static_cast<ParameterGroupItem*>(parent);
para->_hcGrp->RemoveGrp(groupName.c_str());
}
}
}