28 rootPath, QDir::Filters filter) :
30 model_(new QFileSystemModel(this)) {
31 model_->setRootPath(rootPath);
34 connect(
model_, SIGNAL(directoryLoaded(
const QString&)),
this,
46 model_->setRootPath(rootPath);
74 QModelIndex& parent)
const {
75 if (!parent.isValid())
77 else if (!parent.parent().isValid())
80 if (
model_->canFetchMore(parent))
83 return model_->rowCount(parent);
88 row,
const QModelIndex& parent)
const {
89 if (!parent.isValid())
92 return model_->index(row, 0, parent);
97 if ((role == Qt::DisplayRole) || (role == Qt::EditRole))
101 return model_->data(index, role);
112 return model_->rootDirectory().relativeFilePath(
model_->filePath(
117 QModelIndex& pathIndex)
const {
118 if (pathIndex.isValid())
119 return model_->filePath(pathIndex);
126 return model_->rootDirectory().absoluteFilePath(path);
void setFilter(QDir::Filters filter)
QVariant getPathData(const QModelIndex &index, int role) const
QString getFilePath(const QModelIndex &hostIndex, const QModelIndex &pathIndex) const
void pathLoaded(const QString &host, const QString &path)
void modelDirectoryLoaded(const QString &path)
FileScheme(QObject *parent=0, const QString &prefix="file", const QString &rootPath="/", QDir::Filters filter=QDir::NoFilter)
QString getPath(const QModelIndex &hostIndex, const QModelIndex &pathIndex) const
QVariant getHostData(const QModelIndex &index, int role) const
QString getRootPath() const
void setRootPath(const QString &rootPath)
QDir::Filters getFilter() const
QModelIndex getHostIndex(size_t row) const
QFileSystemModel * model_
QString getHost(const QModelIndex &hostIndex) const
QModelIndex getPathIndex(const QModelIndex &hostIndex, size_t row, const QModelIndex &parent=QModelIndex()) const
size_t getNumPaths(const QModelIndex &hostIndex, const QModelIndex &parent) const
size_t getNumHosts() const