Fixed nonfunctional node delete. Was due to trying to find node by name but

passing in the name and comment concatenated together.  Made a new function to
find by name+comment since extracting only name from the text in the column would
require too much guessing.
This commit is contained in:
Andy Huska
2022-09-15 18:59:24 -05:00
parent b6b73d0e11
commit 7e4ebf2c74
3 changed files with 20 additions and 3 deletions
+16 -1
View File
@@ -337,7 +337,22 @@ DBC_NODE* DBCFile::findNodeByName(QString name)
if (dbc_nodes.length() == 0) return nullptr;
for (int i = 0; i < dbc_nodes.length(); i++)
{
if (dbc_nodes[i].name.compare(name, Qt::CaseInsensitive) == 0)
if (name.compare(dbc_nodes[i].name, Qt::CaseInsensitive) == 0)
{
return &dbc_nodes[i];
}
}
return nullptr;
}
DBC_NODE* DBCFile::findNodeByNameAndComment(QString fullname)
{
QString nameAndComment;
if (dbc_nodes.length() == 0) return nullptr;
for (int i = 0; i < dbc_nodes.length(); i++)
{
nameAndComment = dbc_nodes[i].name + " - " + dbc_nodes[i].comment;
if (fullname.compare(nameAndComment, Qt::CaseInsensitive) == 0)
{
return &dbc_nodes[i];
}