Why you not use a model? QStandardItemModel to fille a QTreeView
2 columns column 0 as label and 1 editable to data ... like QDesigner Propriety...


Your way ....

Qt Code:
  1. enum { NumComandButton = 13 }; /* on header */
  2.  
  3. /* valid action */
  4. QList<QAction *> actionlist = Layer->MainActions();
  5. Q_ASSERT ( actionlist.size() == NumComandButton );
  6. for (int i = 0; i < NumComandButton; ++i) {
  7. tbutton[i]->SetAction(actionlist[i]);
  8. tbutton[i]->setEnabled(true);
  9. }
To copy to clipboard, switch view to plain text mode 


The model sample:

write new model 2 column
Qt Code:
  1. QStandardItemModel *PageXmlHandler::ModelBase()
  2. {
  3. bold_base_font = qApp->font();
  4. flags_yes = Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
  5. flags_no = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
  6. bold_base_font.setBold ( true );
  7. model = new QStandardItemModel();
  8.  
  9. QStandardItem *Hitem1 = new QStandardItem(tr("Name"));
  10. QStandardItem *Hitem2 = new QStandardItem(tr("Value"));
  11. Hitem1->setData(bold_base_font,Qt::FontRole);
  12. Hitem2->setData(bold_base_font,Qt::FontRole);
  13. model->setHorizontalHeaderItem(0,Hitem1);
  14. model->setHorizontalHeaderItem(1,Hitem2);
  15. model->invisibleRootItem()->appendRow(ReadOnlyValue("epoche",tr("ID:")));
  16. model->invisibleRootItem()->appendRow(TagValue("cat",tr("Category:")));
  17. model->invisibleRootItem()->appendRow(TagName("tit_",tr("Title:"),5));
  18. model->invisibleRootItem()->appendRow(TagName("desc_",tr("Description:"),15));
  19. model->invisibleRootItem()->appendRow(TagName("note_",tr("Note:")));
  20. model->invisibleRootItem()->appendRow(TagName("autor_",tr("Autor:")));
  21. model->invisibleRootItem()->appendRow(TagValue("active",tr("Priority:")));
  22. model->invisibleRootItem()->appendRow(TagValue("start",tr("Start time:")));
  23. model->invisibleRootItem()->appendRow(TagValue("stop",tr("Stop time:")));
  24. model->invisibleRootItem()->appendRow(TagValue("worksource",tr("Source work:")));
  25. model->invisibleRootItem()->appendRow(TagValue("bgcolor",tr("Background color:")));
  26.  
  27. return model;
  28.  
  29. }
  30. /* each line row */
  31. QList<QStandardItem *> PageXmlHandler::TagValue( const QString shortname , const QString HumanName )
  32. {
  33. QStandardItem *noedit = new QStandardItem(HumanName);
  34. noedit->setFlags(flags_no);
  35. noedit->setData(bold_base_font,Qt::FontRole);
  36. noedit->setData(grundierung,Qt::BackgroundColorRole);
  37. QList<QStandardItem *> diritto;
  38. QStandardItem *Hitem2 = new QStandardItem(Current->Root_Tag(shortname).toString());
  39. Hitem2->setFlags(flags_yes);
  40. Hitem2->setToolTip ( shortname );
  41. Hitem2->setData(shortname,TAGID);
  42. Hitem2->setData(2,T_FORMAT);
  43. Hitem2->setData(Current->Root_Tag(shortname),OLDVALUE);
  44. diritto.append(noedit);
  45. diritto.append(Hitem2);
  46. return diritto;
  47. }
To copy to clipboard, switch view to plain text mode 

at end QTreeView setmodel editable and grab model back data....