Another question about qtreeview...
I created a qtreeview and inserted a checkable item as following:

Qt Code:
  1. MyPlot * plot = new MyPlot;
  2. QStandardItem * item = new QStandardItem(plot->title().text());
  3. item->setData( QVariant::fromValue(plot), PlotRole);
  4. item->setSelectable(false);
  5. item->setEditable(false);
  6. item->setCheckable(true);
  7. item->setCheckState(Qt::Checked);
  8. model->appendRow(item);
  9. myTreeView->setModel(model);
To copy to clipboard, switch view to plain text mode 

...and I've connected the model dataChanged signal to the following slot:

Qt Code:
  1. void MyWidget::onDataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight )
  2. {
  3. QVariant variant = topLeft.data(Spada::PlotRole);
  4. if (!variant.canConvert<MyPlot *>())
  5. return;
  6.  
  7. MyPlot * plot = variant.value<MyPlot *>();
  8.  
  9. variant = topLeft.data(Qt::ChechStateRole);
  10. if (variant.canConvert(QVariant::Int))
  11. {
  12. Qt::CheckState checked = (Qt::CheckState) variant.convert(QVariant::Int);
  13. if (checked == Qt::Unchecked )
  14. plot->hide();
  15. else
  16. plot->show();
  17. }
  18. }
To copy to clipboard, switch view to plain text mode 

Now, when I check/uncheck the item checkbox the slot is called but the checked variable is always Qt::PartiallyChecked...why?
Is there an error in the posted code?