hi,
i get a selection model from a treeview and connect signal
selectionChanged to the following method:

Qt Code:
  1. void
  2. Container_Widget::selectionChanged(const QItemSelection& selected,
  3. const QItemSelection& deselected)
  4. {
  5.  
  6. printf("<Container_Widget::selection changed()>\n");
  7. fflush(stdout);
  8.  
  9. QModelIndexList indexlist = selected.indexes();
  10. QListIterator<QModelIndex> it(indexlist);
  11.  
  12. while(it.hasNext()) {
  13.  
  14. QModelIndex modelindex = it.next();
  15.  
  16. if(!modelindex.isValid()) {
  17. printf("Container_Widget::selectionChanged() : model index not valid \n");
  18. fflush(stdout);
  19. continue;
  20. }
  21.  
  22. printf("Container_Widget::selectionChanged() : row = %d, col = %d \n",
  23. modelindex.row(), modelindex.column() );
  24. fflush(stdout);
  25.  
  26. Container_ModelItem* item
  27. = static_cast<Container_ModelItem*>(modelindex.internalPointer());
  28.  
  29. ... call some method of item -> segfault !!
  30.  
  31. }
  32.  
  33. printf("</Container_Widget::selection changed()>\n");
  34. fflush(stdout);
  35.  
  36. }
To copy to clipboard, switch view to plain text mode 

the problem is that the internal pointer of the model index
cannot be of class Container_ModelItem,
since if i call a method of this class the program crashes.
i checke already all methods of the model which return a QModelIndex,
i could'nt find a mistake there.
where is the mistake?

bets regards,
jh