Hello, i have to add a node in QTreeWidget.
My QTreeWidget before this operation is:
voice1
voice2
|__subvoice1

i want to add a child to subvoice1:
voice1
voice2
|__subvoice1
|__ subsubvoice1

this's the code:
Qt Code:
  1. // disconnect signal
  2. ui.twmConfigtreeWidget->blockSignals ( true );
  3.  
  4. QList<QTreeWidgetItem *> connectionItemsList;
  5. QString nodeNameString;
  6.  
  7. nodeNameString = "voice2";
  8. connectionItemsList = ui.twmConfigtreeWidget->findItems( nodeNameString , Qt::MatchContains , 0 );
  9.  
  10. for ( int i = 0; i < connectionItemsList.size(); i++ )
  11. {
  12. QList<QTreeWidgetItem *> connectionsChildren = connectionItemsList.at( i )->takeChildren();
  13.  
  14. for ( int k = 0; k < connectionsChildren.size(); k++ )
  15. {
  16.  
  17. if ( connectionsChildren.at( i )->text( 0 ) == "subvoice1" )
  18. {
  19. QTreeWidgetItem * twmQTreeWidgetRDPNewConnection = new QTreeWidgetItem ();
  20. twmQTreeWidgetRDPNewConnection->setText( 0 , "subsubvoice1" );
  21. connectionsChildren.at( i )->insertChild( 0 , twmQTreeWidgetRDPNewConnection );
  22.  
  23. }
  24. }
  25. }
  26.  
  27. // connect signal
  28. ui.twmConfigtreeWidget->blockSignals ( false );
To copy to clipboard, switch view to plain text mode 

but it does not work...my tree is always the same...any hint?