QVariant CheckDirModel::data( const QModelIndex& index, int role ) const { #ifdef Q_WS_MAC // return the 'My Computer' icon for the /Volumes folder if ( index.column() == 0 && filePath( index ) == s_macVolumePath ) { switch ( role ) { case Qt::DecorationRole: return myComputer( role ); default: break; } } #endif if ( role == Qt::CheckStateRole ) { return m_checkTable.contains( index ) ? m_checkTable.value( index ) : Qt::Unchecked; } else { return QFileSystemModel::data( index, role ); } }
FileListModel::FileListModel(QObject *parent) : QFileSystemModel(parent) { QString root = myComputer().toString(); setRootPath(root); }