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

Qt Code:
  1. for(int i=0;i<robotvar->getElementsNumber();i++){
  2. QTreeWidgetItem *item = treeWidget->topLevelItem(row);
  3. if(item->childCount() != robotvar->getElementsNumber()){
  4. QTreeWidgetItem *child = new QTreeWidgetItem(item);
  5. child->setText(0,robotvar->getStructureMember(i));
  6. child->setText(1,robotvar->getStructureValue(i,datatype));
  7. }
  8. else{
  9. QTreeWidgetItem *child = item->child(i);
  10. child->setText(1,robotvar->getStructureValue(i,datatype));
  11. }
  12. }
To copy to clipboard, switch view to plain text mode