24 Q_PROPERTY(
bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks)
25 Q_PROPERTY(
bool readOnly READ isReadOnly WRITE setReadOnly)
26 Q_PROPERTY(
bool nameFilterDisables READ nameFilterDisables WRITE setNameFilterDisables)
27 Q_PROPERTY(Options options READ options WRITE setOptions)
30 void rootPathChanged(
const QString &newPath);
31 void fileRenamed(
const QString &path,
const QString &oldName,
const QString &newName);
32 void directoryLoaded(
const QString &path);
36 FileIconRole = Qt::DecorationRole,
38 FileInfoRole = Qt::FileInfoRole,
40 FilePathRole = Qt::UserRole - 3,
41 FileNameRole = Qt::UserRole - 2,
42 FilePermissions = Qt::UserRole - 1,
46 FilePathRole = Qt::UserRole + 1,
47 FileNameRole = Qt::UserRole + 2,
48 FilePermissions = Qt::UserRole + 3,
54 DontWatchForChanges = 0x00000001,
55 DontResolveSymlinks = 0x00000002,
56 DontUseCustomDirectoryIcons = 0x00000004
59 Q_DECLARE_FLAGS(Options, Option)
61 explicit QFileSystemModel(QObject *parent =
nullptr);
64 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
65 QModelIndex index(
const QString &path,
int column = 0)
const;
66 QModelIndex parent(
const QModelIndex &child)
const override;
67 using QObject::parent;
68 QModelIndex sibling(
int row,
int column,
const QModelIndex &idx)
const override;
69 bool hasChildren(
const QModelIndex &parent = QModelIndex())
const override;
70 bool canFetchMore(
const QModelIndex &parent)
const override;
71 void fetchMore(
const QModelIndex &parent) override;
73 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
74 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
76 QVariant myComputer(
int role = Qt::DisplayRole)
const;
77 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
78 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole) override;
80 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
82 Qt::ItemFlags flags(
const QModelIndex &index)
const override;
84 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder) override;
86 QStringList mimeTypes()
const override;
87 QMimeData *mimeData(
const QModelIndexList &indexes)
const override;
88 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
89 int row,
int column,
const QModelIndex &parent) override;
90 Qt::DropActions supportedDropActions()
const override;
91 QHash<
int, QByteArray> roleNames()
const override;
94 QModelIndex setRootPath(
const QString &path);
95 QString rootPath()
const;
96 QDir rootDirectory()
const;
98 void setIconProvider(QAbstractFileIconProvider *provider);
99 QAbstractFileIconProvider *iconProvider()
const;
101 void setFilter(QDir::Filters filters);
102 QDir::Filters filter()
const;
104 void setResolveSymlinks(
bool enable);
105 bool resolveSymlinks()
const;
107 void setReadOnly(
bool enable);
108 bool isReadOnly()
const;
110 void setNameFilterDisables(
bool enable);
111 bool nameFilterDisables()
const;
113 void setNameFilters(
const QStringList &filters);
114 QStringList nameFilters()
const;
116 void setOption(Option option,
bool on =
true);
117 bool testOption(Option option)
const;
118 void setOptions(Options options);
119 Options options()
const;
121 QString filePath(
const QModelIndex &index)
const;
122 bool isDir(
const QModelIndex &index)
const;
123 qint64 size(
const QModelIndex &index)
const;
124 QString type(
const QModelIndex &index)
const;
126 QDateTime lastModified(
const QModelIndex &index)
const;
127 QDateTime lastModified(
const QModelIndex &index,
const QTimeZone &tz)
const;
129 QModelIndex mkdir(
const QModelIndex &parent,
const QString &name);
130 bool rmdir(
const QModelIndex &index);
131 inline QString fileName(
const QModelIndex &index)
const;
132 inline QIcon fileIcon(
const QModelIndex &index)
const;
133 QFile::Permissions permissions(
const QModelIndex &index)
const;
134 QFileInfo fileInfo(
const QModelIndex &index)
const;
135 bool remove(
const QModelIndex &index);
138 QFileSystemModel(QFileSystemModelPrivate &, QObject *parent =
nullptr);
139 void timerEvent(QTimerEvent *event) override;
140 bool event(QEvent *event) override;
143 Q_DECLARE_PRIVATE(QFileSystemModel)
144 Q_DISABLE_COPY(QFileSystemModel)
146 friend class QFileDialogPrivate;