Originally, I posted about a problem I was having, but got no response:

I had a QTreeView and wanted to change the color of one of the entries in the view. I opted to change the QTreeView into a QTreeWidget and called QTreeView::setModel() to set my model to match the view.

While the model-view interface works fine, I seem to get a segmentation fault when I do the following in a member function:

Qt Code:
  1. void DatabaseTreeWidget::Update_Tree_From_Flags()
  2. {
  3.  
  4. X = topLevelItem(0);
  5. X->setTextColor(1,QColor(Qt::darkGreen));
  6. }
To copy to clipboard, switch view to plain text mode 

Why does this happen? I want to change the color of the top level tree item, but am clearly having difficulty.