11#include <QtCore/qcollator.h>
12#if QT_CONFIG(regularexpression)
13# include <QtCore/qregularexpression.h>
19# include <QtCore/QVarLengthArray>
134 return d->node(
index)->fileInfo();
177#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
180 const QStringList watchedPaths =
d->unwatchPathsAt(aindex);
184#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
186 d->watchPaths(watchedPaths);
229 const int i =
d->translateVisibleLocation(parentNode,
row);
273 if (!
index.isValid())
283 if (strShortPath.isEmpty()
284 || strShortPath ==
"."_L1 || strShortPath ==
".."_L1)
286 if (strShortPath.length() == 2 && strShortPath.endsWith(u
':'))
289 if (absPath.startsWith(
"//"_L1)
290 || absPath.startsWith(
"\\\\"_L1))
292 if (absPath.startsWith(u
'/'))
296 DWORD
result = ::GetLongPathName((
wchar_t*)inputString.utf16(),
301 result = ::GetLongPathName((
wchar_t*)inputString.utf16(),
307 longPath[0] = longPath.at(0).toUpper();
341 if ((pathElements.isEmpty())
342#
if !defined(Q_OS_WIN)
349 QChar separator = u
'/';
353 QString host =
"\\\\"_L1 + pathElements.constFirst();
356 if (longPath.endsWith(u
'/') && !
absolutePath.endsWith(u
'/'))
359 trailingSeparator =
"\\"_L1;
366 if (pathElements.count() == 1 && !
absolutePath.endsWith(u
'/'))
378 pathElements.pop_front();
381 elementPath.
append(separator);
383 if (!pathElements.at(0).contains(u
':')) {
385 pathElements.prepend(rootPath);
387 if (pathElements.at(0).endsWith(u
'/'))
388 pathElements[0].chop(1);
393 pathElements.prepend(
"/"_L1);
398 for (
int i = 0;
i < pathElements.size(); ++
i) {
399 QString element = pathElements.at(
i);
401 elementPath.append(separator);
402 elementPath.append(element);
403 if (
i == pathElements.size() - 1)
404 elementPath.append(trailingSeparator);
423 if (alreadyExisted) {
425 || (
parent->caseSensitive()
427 || (!
parent->caseSensitive()
429 alreadyExisted =
false;
433 if (!alreadyExisted) {
441#if QT_CONFIG(filesystemwatcher)
456 if (!
p->bypassFilters.contains(
node))
457 p->bypassFilters[
node] = 1;
461 p->toFetch.append(std::move(
f));
477 if (
event->timerId() ==
d->fetchingTimer.timerId()) {
478 d->fetchingTimer.stop();
479#if QT_CONFIG(filesystemwatcher)
480 for (
int i = 0;
i <
d->toFetch.size(); ++
i) {
483 d->fileInfoGatherer->fetchExtendedInformation(
d->toFetch.at(
i).dir,
502 if (!
index.isValid())
505 if (
n->hasInformation())
516 if (!
index.isValid())
518 return d->node(
index)->size();
527 if (!
index.isValid())
529 return d->node(
index)->type();
562 if (!
index.isValid())
564 return d->node(
index)->lastModified(
tz);
573 if (!
d->indexValid(
index))
579 if (parentNode ==
nullptr || parentNode == &
d->root)
585 int visualRow =
d->translateVisibleLocation(grandParentNode, grandParentNode->visibleLocation(grandParentNode->children.value(parentNode->
fileName)->fileName));
626 return (indexNode->isDir());
638 return (!indexNode->populatedChildren);
650 if (indexNode->populatedChildren)
653#if QT_CONFIG(filesystemwatcher)
668 return d->root.visibleChildren.size();
689#if QT_CONFIG(filesystemwatcher)
695#if QT_CONFIG(filesystemwatcher)
697 if (
auto *provider =
d->fileInfoGatherer->iconProvider())
711 if (!
index.isValid() ||
index.model() !=
this)
720 switch (
index.column()) {
726 qWarning(
"data: invalid display value column %d",
index.column());
739#if QT_CONFIG(filesystemwatcher)
742 if (
auto *provider =
d->fileInfoGatherer->iconProvider())
743 icon = provider->icon(
d->node(
index)->isDir() ? P::Folder: P::File);
766 if (!
index.isValid())
780 return size(
n->size());
793 if (!
index.isValid())
795#if QT_CONFIG(datestring)
808 if (!
index.isValid())
818 if (!
index.isValid())
823 fileInfoGatherer->resolveSymlinks() &&
829 return dirNode->fileName;
839 if (!dirNode->volumeName.isEmpty())
840 return dirNode->volumeName;
850 if (!
index.isValid())
870 if (newName == oldName)
878#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
881 const QStringList watchedPaths =
d->unwatchPathsAt(idx);
883 if (!
QDir(parentPath).rename(oldName, newName)) {
884#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
885 d->watchPaths(watchedPaths);
904 std::unique_ptr<QFileSystemModelPrivate::QFileSystemNode> nodeToRename(parentNode->
children.take(oldName));
905 nodeToRename->fileName = newName;
906 nodeToRename->parent = parentNode;
907#if QT_CONFIG(filesystemwatcher)
910 nodeToRename->isVisible =
true;
911 parentNode->
children[newName] = nodeToRename.release();
945 returnValue =
tr(
"Name");
948 returnValue =
tr(
"Size");
953 tr(
"Kind",
"Match OS X Finder");
955 tr(
"Type",
"All other platforms");
963 returnValue =
tr(
"Date Modified");
977 if (!
index.isValid())
981 if (
d->nameFilterDisables && !
d->passNameFilters(indexNode)) {
989 if (!indexNode->isDir())
995 if (indexNode->isDir())
1027 switch (sortColumn) {
1047 if (sizeDifference == 0)
1050 return sizeDifference < 0;
1095 if (indexNode->children.size() == 0)
1098 QList<QFileSystemModelPrivate::QFileSystemNode *>
values;
1100 for (
auto iterator = indexNode->children.constBegin(), cend = indexNode->children.constEnd(); iterator != cend; ++iterator) {
1102 values.append(iterator.value());
1104 iterator.value()->isVisible =
false;
1110 indexNode->visibleChildren.clear();
1112 indexNode->dirtyChildrenIndex = -1;
1113 indexNode->visibleChildren.reserve(
values.size());
1120 for (
int i = 0;
i <
q->rowCount(
parent); ++
i) {
1124 if (indexNode->isVisible)
1136 if (
d->sortOrder ==
order &&
d->sortColumn ==
column && !
d->forceSort)
1141 QList<QPair<QFileSystemModelPrivate::QFileSystemNode *, int>> oldNodes;
1142 oldNodes.reserve(oldList.size());
1144 QPair<QFileSystemModelPrivate::QFileSystemNode*, int> pair(
d->node(oldNode), oldNode.column());
1145 oldNodes.append(pair);
1148 if (!(
d->sortColumn ==
column &&
d->sortOrder !=
order && !
d->forceSort)) {
1152 d->forceSort =
false;
1157 newList.
reserve(oldNodes.size());
1158 for (
const auto &[node, col]: std::as_const(oldNodes))
1159 newList.append(
d->index(node, col));
1186 for (;
it != indexes.
end(); ++
it)
1190 data->setUrls(urls);
1210 bool success =
true;
1213 QList<QUrl> urls =
data->urls();
1218 for (;
it != urls.constEnd(); ++
it) {
1224 for (;
it != urls.constEnd(); ++
it) {
1230 for (;
it != urls.constEnd(); ++
it) {
1296 QFileSystemModel::Options previousOptions =
options();
1331#if QT_CONFIG(filesystemwatcher)
1339 QAbstractFileIconProvider::Options providerOptions = provider->options();
1342 provider->setOptions(providerOptions);
1344 qWarning(
"Setting QFileSystemModel::DontUseCustomDirectoryIcons has no effect when no provider is used");
1351 QFileSystemModel::Options
result;
1353#if QT_CONFIG(filesystemwatcher)
1375 if (dirNode->isSymLink()
1377 &&
d->fileInfoGatherer->resolveSymlinks()
1379 &&
d->resolvedSymLinks.contains(fullPath)
1380 && dirNode->isDir()) {
1381 QFileInfo fullPathInfo(dirNode->fileInfo());
1382 if (!dirNode->hasInformation())
1385 auto *canonicalNode =
d->node(fullPathInfo.canonicalFilePath(),
false);
1386 QFileInfo resolvedInfo = canonicalNode->fileInfo();
1387 if (!canonicalNode->hasInformation())
1389 if (resolvedInfo.exists())
1390 return resolvedInfo.filePath();
1399 if (!
index.isValid())
1408 path.prepend(dirNode->fileName);
1412#if !defined(Q_OS_WIN)
1413 if ((fullPath.size() > 2) && fullPath[0] == u
'/' && fullPath[1] == u
'/')
1414 fullPath = fullPath.mid(1);
1416 if (fullPath.length() == 2 && fullPath.endsWith(u
':'))
1417 fullPath.append(u
'/');
1438#if QT_CONFIG(filesystemwatcher)
1442 return d->index(node);
1451 return d->node(
index)->permissions();
1472 QString longNewPath = qt_GetLongPathName(newPath);
1477 QString longNewPath = newPath;
1480 if (!newPath.isEmpty())
1483 d->setRootPath =
true;
1486 if (!newPath.isEmpty() && longNewPath.isEmpty())
1489 if (
d->rootDir.path() == longNewPath)
1492 auto node =
d->node(longNewPath);
1494 if (node && node->hasInformation())
1495 newPathInfo = node->fileInfo();
1500 if (!showDrives && !newPathInfo.exists())
1506#if QT_CONFIG(filesystemwatcher)
1507 d->fileInfoGatherer->removePath(
rootPath());
1512 d->node(
rootPath())->populatedChildren =
false;
1516 d->rootDir =
QDir(longNewPath);
1520 d->rootDir.setPath(
""_L1);
1522 newRootIndex =
d->index(
d->rootDir.path());
1526 d->forceSort =
true;
1528 return newRootIndex;
1539 return d->rootDir.path();
1562#if QT_CONFIG(filesystemwatcher)
1563 d->fileInfoGatherer->setIconProvider(provider);
1565 d->root.updateIcon(provider,
QString());
1573#if QT_CONFIG(filesystemwatcher)
1575 return d->fileInfoGatherer->iconProvider();
1594 const bool changingCaseSensitivity =
1597 if (changingCaseSensitivity)
1598 d->rebuildNameFilterRegexps();
1599 d->forceSort =
true;
1629#if QT_CONFIG(filesystemwatcher)
1631 d->fileInfoGatherer->setResolveSymlinks(
enable);
1639#if QT_CONFIG(filesystemwatcher)
1641 return d->fileInfoGatherer->resolveSymlinks();
1677 if (
d->nameFilterDisables ==
enable)
1679 d->nameFilterDisables =
enable;
1680 d->forceSort =
true;
1687 return d->nameFilterDisables;
1695#if QT_CONFIG(regularexpression)
1698 if (!
d->bypassFilters.isEmpty()) {
1700 d->bypassFilters.clear();
1704 for (
const auto &persistentIndex : persistentList) {
1707 if (
d->bypassFilters.contains(node))
1710 d->bypassFilters[node] =
true;
1717 d->rebuildNameFilterRegexps();
1718 d->forceSort =
true;
1730#if QT_CONFIG(regularexpression)
1732 return d->nameFilters;
1743#if QT_CONFIG(filesystemwatcher)
1746 d->root.retranslateStrings(
d->fileInfoGatherer->iconProvider(),
QString());
1757#if QT_CONFIG(filesystemwatcher)
1760 d->fileInfoGatherer->removePath(
path);
1775 if (parentNode->
children.size() == 0)
1779 std::sort(newFiles.begin(), newFiles.end());
1780 for (
auto i = parentNode->
children.constBegin(), cend = parentNode->
children.constEnd();
i != cend; ++
i) {
1781 QStringList::iterator iterator = std::lower_bound(newFiles.begin(), newFiles.end(),
i.value()->fileName);
1782 if ((iterator == newFiles.end()) || (
i.value()->fileName < *iterator))
1783 toRemove.append(
i.value()->fileName);
1785 for (
int i = 0 ;
i < toRemove.size() ; ++
i )
1789#if defined(Q_OS_WIN)
1792 IShellItem *
item =
nullptr;
1794 HRESULT hr = SHCreateItemFromParsingName(
reinterpret_cast<const wchar_t *
>(native.
utf16()),
1795 nullptr, IID_IShellItem,
1796 reinterpret_cast<void **
>(&
item));
1799 LPWSTR
name =
nullptr;
1800 hr =
item->GetDisplayName(SIGDN_NORMALDISPLAY, &
name);
1804 CoTaskMemFree(
name);
1821#if QT_CONFIG(filesystemwatcher)
1826#if defined(Q_OS_WIN)
1851 if (vLocation >= 0 && !indexHidden)
1859 if (vLocation >= 0 && !indexHidden)
1883 for (
const auto &newFile : newFiles) {
1885 parentNode->
children.value(newFile)->isVisible =
true;
1901 if (vLocation == -1)
1921 const QList<std::pair<QString, QFileInfo>> &updates)
1923#if QT_CONFIG(filesystemwatcher)
1925 QList<QString> rowsToUpdate;
1929 for (
const auto &update : updates) {
1934 if (!previouslyHere) {
1939 if (isCaseSensitive) {
1946 if (isCaseSensitive) {
1974 std::sort(rowsToUpdate.begin(), rowsToUpdate.end());
1977 for (
const QString &
value : std::as_const(rowsToUpdate)) {
1995 && visibleMin < parentNode->visibleChildren.size()
1997 && visibleMax >= 0) {
1999 const int lastColumn =
q->columnCount(parentIndex) - 1;
2003 lastColumn, parentIndex);
2014 if (newFiles.size() > 0) {
2018 if (newFiles.size() > 0 || (
sortColumn != 0 && rowsToUpdate.size() > 0)) {
2036#if QT_CONFIG(filesystemwatcher) && defined(Q_OS_WIN)
2044 if (indexNode ==
nullptr)
2048 const QString path = indexNode->fileInfo().absoluteFilePath();
2053 const int pathSize =
path.size();
2054 if (pathSize == watchedPath.size()) {
2055 return path.compare(watchedPath, caseSensitivity) == 0;
2056 }
else if (watchedPath.size() > pathSize) {
2057 return watchedPath.at(pathSize) == u
'/'
2058 && watchedPath.startsWith(
path, caseSensitivity);
2063 const QStringList &watchedFiles = fileInfoGatherer->watchedFiles();
2064 std::copy_if(watchedFiles.cbegin(), watchedFiles.cend(),
2067 const QStringList &watchedDirectories = fileInfoGatherer->watchedDirectories();
2068 std::copy_if(watchedDirectories.cbegin(), watchedDirectories.cend(),
2071 fileInfoGatherer->unwatchPaths(
result);
2077#if QT_CONFIG(filesystemwatcher)
2085#if QT_CONFIG(filesystemwatcher)
2086 fileInfoGatherer->requestAbort();
2087 if (!fileInfoGatherer->wait(1000)) {
2093 auto *rawGatherer = fileInfoGatherer.release();
2094 rawGatherer->deleteLater();
2108 qRegisterMetaType<QList<std::pair<QString, QFileInfo>>>();
2109#if QT_CONFIG(filesystemwatcher)
2138 const bool shouldHideDirNode = hideDirs &&
node->
isDir();
2163 if ( (hideHidden && !(isDot || isDotDot) &&
node->
isHidden())
2171 || (hideDot && isDot)
2172 || (hideDotDot && isDotDot))
2185#if QT_CONFIG(regularexpression)
2186 if (nameFilters.isEmpty())
2195 return std::any_of(nameFiltersRegexps.begin(),
2196 nameFiltersRegexps.end(),
2197 matchesNodeFileName);
2205#if QT_CONFIG(regularexpression)
2206void QFileSystemModelPrivate::rebuildNameFilterRegexps()
2208 nameFiltersRegexps.clear();
2209 nameFiltersRegexps.reserve(nameFilters.size());
2211 const auto convertWildcardToRegexp = [cs](
const QString &nameFilter)
2215 std::transform(nameFilters.constBegin(),
2216 nameFilters.constEnd(),
2217 std::back_inserter(nameFiltersRegexps),
2218 convertWildcardToRegexp);
2224#include "moc_qfilesystemmodel.cpp"
@ DontUseCustomDirectoryIcons
virtual Q_INVOKABLE QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Returns the data for the given role and section in the header with the specified orientation.
virtual Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
QModelIndexList persistentIndexList() const
Q_INVOKABLE Qt::SortOrder order
void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to)
void layoutAboutToBeChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
void layoutChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
virtual Q_INVOKABLE QModelIndex sibling(int row, int column, const QModelIndex &idx) const
Returns the sibling at row and column for the item at index, or an invalid QModelIndex if there is no...
virtual QHash< int, QByteArray > roleNames() const
QModelIndex createIndex(int row, int column, const void *data=nullptr) const
Creates a model index for the given row and column with the internal pointer ptr.
void setNumericMode(bool on)
Enables numeric sorting mode when on is true.
void setCaseSensitivity(Qt::CaseSensitivity cs)
Sets the case-sensitivity of the collator to cs.
int compare(const QString &s1, const QString &s2) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore\reentrant
static QString fromNativeSeparators(const QString &pathName)
QString path() const
Returns the path.
static QChar separator()
Returns the native directory separator: "/" under Unix and "\\" under Windows.
QString absolutePath() const
Returns the absolute path (a path that starts with "/" or with a drive specification),...
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
static QString toNativeSeparators(const QString &pathName)
static QString rootPath()
Returns the absolute path of the root directory.
bool rmdir(const QString &dirName) const
Removes the directory specified by dirName.
void newListOfFiles(const QString &directory, const QStringList &listOfFiles) const
void updates(const QString &directory, const QList< std::pair< QString, QFileInfo > > &updates)
void nameResolved(const QString &fileName, const QString &resolvedName) const
void directoryLoaded(const QString &path)
bool isFile() const
Returns true if this object points to a file or to a symbolic link to a file.
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory.
void populate(const QExtendedInformation &fileInfo)
bool hasInformation() const
QDateTime lastModified(const QTimeZone &tz) const
QHash< QFileSystemModelNodePathKey, QFileSystemNode * > children
QList< QString > visibleChildren
bool isSymLink(bool ignoreNtfsSymLinks=false) const
int visibleLocation(const QString &childName)
bool isExecutable() const
bool caseSensitive() const
bool passNameFilters(const QFileSystemNode *node) const
QHash< const QFileSystemNode *, bool > bypassFilters
QHash< QString, QString > resolvedSymLinks
QString name(const QModelIndex &index) const
QString filePath(const QModelIndex &index) const
QModelIndex index(const QString &path, int column=0)
QFileSystemNode * addNode(QFileSystemNode *parentNode, const QString &fileName, const QFileInfo &info)
QString type(const QModelIndex &index) const
QString time(const QModelIndex &index) const
QString size(const QModelIndex &index) const
bool isHiddenByFilter(QFileSystemNode *indexNode, const QModelIndex &index) const
void performDelayedSort()
bool disableRecursiveSort
QFileSystemModelPrivate()
void resolvedName(const QString &fileName, const QString &resolvedName)
QIcon icon(const QModelIndex &index) const
void directoryChanged(const QString &directory, const QStringList &list)
bool filtersAcceptsNode(const QFileSystemNode *node) const
QFileSystemNode * node(const QModelIndex &index) const
void sortChildren(int column, const QModelIndex &parent)
void removeVisibleFile(QFileSystemNode *parentNode, int visibleLocation)
void removeNode(QFileSystemNode *parentNode, const QString &name)
int translateVisibleLocation(QFileSystemNode *parent, int row) const
static QString myComputer()
void fileSystemChanged(const QString &path, const QList< std::pair< QString, QFileInfo > > &)
void addVisibleFiles(QFileSystemNode *parentNode, const QStringList &newFiles)
~QFileSystemModelPrivate()
QString displayName(const QModelIndex &index) const
bool compareNodes(const QFileSystemModelPrivate::QFileSystemNode *l, const QFileSystemModelPrivate::QFileSystemNode *r) const
QFileSystemModelSorter(int column)
bool operator()(const QFileSystemModelPrivate::QFileSystemNode *l, const QFileSystemModelPrivate::QFileSystemNode *r) const
The QFileSystemModel class provides a data model for the local filesystem.
QModelIndex mkdir(const QModelIndex &parent, const QString &name)
Create a directory with the name in the parent model index.
QModelIndex setRootPath(const QString &path)
Sets the directory that is being watched by the model to newPath by installing a \l{QFileSystemWatche...
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
\reimp
QDir rootDirectory() const
The currently set directory.
void setOptions(Options options)
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
Handles the data supplied by a drag and drop operation that ended with the given action over the row ...
bool nameFilterDisables
Whether files that don't pass the name filter are hidden or disabled.
void setNameFilterDisables(bool enable)
@ DontUseCustomDirectoryIcons
void fileRenamed(const QString &path, const QString &oldName, const QString &newName)
This signal is emitted whenever a file with the oldName is successfully renamed to newName.
bool canFetchMore(const QModelIndex &parent) const override
\reimp
bool rmdir(const QModelIndex &index)
Removes the directory corresponding to the model item index in the file system model and {deletes the...
bool testOption(Option option) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
\reimp
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
\reimp
void rootPathChanged(const QString &newPath)
This signal is emitted whenever the root path has been changed to a newPath.
QString rootPath() const
The currently set root path.
void setOption(Option option, bool on=true)
QString type(const QModelIndex &index) const
Returns the type of file index such as "Directory" or "JPEG file".
QFileInfo fileInfo(const QModelIndex &index) const
Returns the QFileInfo for the item stored in the model under the given index.
QFile::Permissions permissions(const QModelIndex &index) const
Returns the complete OR-ed together combination of QFile::Permission for the index.
QObject * parent() const
Returns a pointer to the parent object.
~QFileSystemModel()
Destroys this file system model.
QString filePath(const QModelIndex &index) const
Returns the path of the item stored in the model under the index given.
QModelIndex sibling(int row, int column, const QModelIndex &idx) const override
\reimp
bool event(QEvent *event) override
\reimp
qint64 size(const QModelIndex &index) const
Returns the size in bytes of index.
QFileSystemModel(QObject *parent=nullptr)
Constructs a file system model with the given parent.
QStringList nameFilters() const
Returns a list of filters applied to the names in the model.
Qt::DropActions supportedDropActions() const override
\reimp
void setIconProvider(QAbstractFileIconProvider *provider)
Sets the provider of file icons for the directory model.
QVariant myComputer(int role=Qt::DisplayRole) const
Returns the data stored under the given role for the item "My Computer".
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
\reimp
void fetchMore(const QModelIndex &parent) override
\reimp
bool resolveSymlinks
Whether the directory model should resolve symbolic links.
void directoryLoaded(const QString &path)
void setReadOnly(bool enable)
QDateTime lastModified(const QModelIndex &index) const
Returns the date and time (in local time) when index was last modified.
void setNameFilters(const QStringList &filters)
Sets the name filters to apply against the existing files.
QStringList mimeTypes() const override
Returns a list of MIME types that can be used to describe a list of items in the model.
QHash< int, QByteArray > roleNames() const override
\reimp
bool hasChildren(const QModelIndex &parent=QModelIndex()) const override
\reimp
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
\reimp
QAbstractFileIconProvider * iconProvider() const
Returns the file icon provider for this directory model.
QDir::Filters filter() const
Returns the filter specified for the directory model.
void setResolveSymlinks(bool enable)
void setFilter(QDir::Filters filters)
Sets the directory model's filter to that specified by filters.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
\reimp
QMimeData * mimeData(const QModelIndexList &indexes) const override
Returns an object that contains a serialized description of the specified indexes.
void timerEvent(QTimerEvent *event) override
\reimp
Options options
the various options that affect the model
bool remove(const QModelIndex &index)
Removes the model item index from the file system model and {deletes the corresponding file from the ...
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
int rowCount(const QModelIndex &parent=QModelIndex()) const override
\reimp
bool isDir(const QModelIndex &index) const
Returns true if the model item index represents a directory; otherwise returns false.
bool link(const QString &newName)
Creates a link named linkName that points to the file currently specified by fileName().
bool copy(const QString &newName)
Copies the file named fileName() to newName.
bool remove()
Removes the file specified by fileName().
bool rename(const QString &newName)
Renames the file currently specified by fileName() to newName.
T value(const Key &key) const noexcept
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
The QIcon class provides scalable icons in different modes and states.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
@ Format_ARGB32_Premultiplied
qsizetype size() const noexcept
void removeAt(qsizetype i)
iterator insert(qsizetype i, parameter_type t)
const_reference at(qsizetype i) const noexcept
T value(qsizetype i) const
void reserve(qsizetype size)
void append(parameter_type t)
static QLocale system()
Returns a QLocale object initialized to the system locale.
QVariant data(int role=Qt::DisplayRole) const
Returns the data for the given role for the item referred to by the index.
constexpr int row() const noexcept
Returns the row this model index refers to.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
constexpr int column() const noexcept
Returns the column this model index refers to.
void * internalPointer() const noexcept
Returns a {void} {*} pointer used by the model to associate the index with the internal data structur...
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
const QObjectList & children() const
Returns a list of child objects.
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
\inmodule QtCore \reentrant
static QRegularExpression fromWildcard(QStringView pattern, Qt::CaseSensitivity cs=Qt::CaseInsensitive, WildcardConversionOptions options=DefaultWildcardConversion)
\macro QT_RESTRICTED_CAST_FROM_ASCII
void chop(qsizetype n)
Removes n characters from the end of the string.
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
QString first(qsizetype n) const &
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString toLower() const &
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString fromWCharArray(const wchar_t *string, qsizetype size=-1)
QString & append(QChar c)
QString toUpper() const &
void setSingleShot(bool singleShot)
void timeout(QPrivateSignal)
This signal is emitted when the timer times out.
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
QSet< QString >::iterator it
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
QList< QString > QStringList
Constructs a string list that contains the given string, str.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLsizei GLsizei GLint * values
[15]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble top
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLenum GLenum GLsizei void GLsizei void * column
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLenum GLenum GLsizei void * row
GLfixed GLfixed GLint GLint order
static QString absolutePath(const QString &path)
static QString canonicalPath(const QString &rootPath)
#define QT_CONFIG(feature)
static int compare(quint64 a, quint64 b)
const QStringList filters({"Image files (*.png *.xpm *.jpg)", "Text files (*.txt)", "Any files (*)" })
[6]
bool contains(const AT &t) const noexcept