Hi!

I have a QTreeview which displays a FilesystemModel with Checkboxes before the files. If a directory gets checked and has childs, all the subitems should get checked.
The logic is working BUT the view does not get refreshed!
If I have the directory with sub-items expanded I have to collapse/expand it again to see the (correct) rendered result.
The code in question is this:
Qt Code:
  1. QVariant FileModel::data(const QModelIndex &index, int role) const
  2. {
  3. if(index.isValid() && index.column() == 0 && role == Qt::CheckStateRole) {
  4. const QString path = this->filePath(index);
  5. if(m_files.isEmpty()) {
  6. return Qt::Unchecked;
  7. }
  8. if(m_files.contains(path)) {
  9. return Qt::Checked;
  10. }
  11. if(m_excludeFiles.contains(path)) {
  12. return Qt::Unchecked;
  13. }
  14. if(parentIsExcluded(path)) {
  15. return Qt::Unchecked;
  16. }
  17. if(parentIsChecked(path)){
  18. return Qt::Checked;
  19. }
  20. return Qt::Unchecked;
  21. }
  22. return QFileSystemModel::data(index, role);
  23. }
To copy to clipboard, switch view to plain text mode 

The flags method returns
Qt Code:
  1. defaultFlags |= Qt::ItemIsUserCheckable;
To copy to clipboard, switch view to plain text mode 
setData just fills my QSets (m_files, m_excludeFiles) and returns true or calls QFileSystemModel::setData(index, value, role);

What am I missing?
Thank you very much

m.