hi,
I have this question: I have a two-dimensional array of variable names and variable values. I have make a treewidget with two colums: names and values.
I want update the variables values any second (or more). Same time also the number of variables changed.
I write this code, it work but I things is not the correct way
for(int i=0;i<robotvar->getElementsNumber();i++){
if(item->childCount() != robotvar->getElementsNumber()){
child->setText(0,robotvar->getStructureMember(i));
child->setText(1,robotvar->getStructureValue(i,datatype));
}
else{
child->setText(1,robotvar->getStructureValue(i,datatype));
}
}
for(int i=0;i<robotvar->getElementsNumber();i++){
QTreeWidgetItem *item = treeWidget->topLevelItem(row);
if(item->childCount() != robotvar->getElementsNumber()){
QTreeWidgetItem *child = new QTreeWidgetItem(item);
child->setText(0,robotvar->getStructureMember(i));
child->setText(1,robotvar->getStructureValue(i,datatype));
}
else{
QTreeWidgetItem *child = item->child(i);
child->setText(1,robotvar->getStructureValue(i,datatype));
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks