title: Assigning Icons to items in QTreeView
body: <p>I have a class inheriting from QTreeView. I need to assign icons to different types of files and directories. There is this solution given from <a href="https://stackoverflow.com/questions/27587035/qfilesystemmodel-custom-icons">this question</a>:</p>
  
  <pre><code>QVariant MyQFileSystemModel::data( const QModelIndex&amp; index, int role ) const {
      if( role == Qt::DecorationRole )
      {
          QFileInfo info = MyQFileSystemModel::fileInfo(index);
  
          if(info.isFile())
          {
              if(info.suffix() == "dat")
                  return QPixmap(":/icons/File_Icon.png");//I pick the icon depending on the extension
              else if(info.suffix() == "mcr")
                  return QPixmap(":/icons/Region_Icon.png");
          }
      }
      return QFileSystemModel::data(index, role);
  }
  </code></pre>
  
  <p>My class does not inherit from QFileSystemModel but rather compose it in, which means I cannot overide the function <code>data()</code>.
  From the above, how will the icons show up? Is it by just calling data() in a constructor?</p>