55 #include <QtCore/QVarLengthArray> 60 #ifndef QT_NO_FILESYSTEMMODEL 241 for (
int i = 0; i < children.
count(); ++i) {
246 if (children.
at(i) != path)
247 error |=
remove(modelIndex);
248 error |=
rmdir(modelIndex);
302 return createIndex(row, column, const_cast<QFileSystemModelPrivate::QFileSystemNode*>(indexNode));
318 if (idx.
column() != column)
334 return const_cast<QFileSystemNode*>(&root);
356 DWORD result = ::GetLongPathName((
wchar_t*)inputString.
utf16(),
359 if (result > DWORD(buffer.
size())) {
361 result = ::GetLongPathName((
wchar_t*)inputString.
utf16(),
385 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
390 QString longPath = qt_GetLongPathName(path);
394 if (longPath == rootDir.path())
395 absolutePath = rootDir.absolutePath();
402 #
if (!defined(
Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(Q_OS_SYMBIAN)
406 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
408 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) 417 if (!root.children.contains(host.
toLower())) {
424 p->
addNode(rootNode, host,info);
428 r = translateVisibleLocation(rootNode, r);
434 #if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN) 440 pathElements.
prepend(rootPath);
443 pathElements[0].chop(1);
453 for (
int i = 0; i < pathElements.
count(); ++i) {
460 bool alreadyExisted = parent->
children.contains(element);
464 if (alreadyExisted) {
467 && parent->
children.value(element)->fileName != element)
469 && parent->
children.value(element)->fileName.toLower() != element.
toLower()))
470 alreadyExisted =
false;
474 if (!alreadyExisted) {
479 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
481 node = p->
addNode(parent, element,info);
482 #ifndef QT_NO_FILESYSTEMWATCHER 483 node->
populate(fileInfoGatherer.getInfo(info));
486 node = parent->
children.value(element);
493 return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
499 QString dir = q->filePath(this->index(parent));
521 if (event->
timerId() ==
d->fetchingTimer.timerId()) {
522 d->fetchingTimer.stop();
523 #ifndef QT_NO_FILESYSTEMWATCHER 524 for (
int i = 0; i <
d->toFetch.count(); ++i) {
527 d->fileInfoGatherer.fetchExtendedInformation(
d->toFetch.at(i).dir,
562 return d->node(index)->size();
573 return d->node(index)->type();
584 return d->node(index)->lastModified();
593 if (!
d->indexValid(index))
599 if (parentNode == 0 || parentNode == &
d->root)
605 int visualRow =
d->translateVisibleLocation(grandParentNode, grandParentNode->
visibleLocation(grandParentNode->
children.value(parentNode->
fileName)->fileName));
620 if (node == &root || !parentNode)
629 return q->createIndex(visualRow, 0, const_cast<QFileSystemNode*>(node));
646 return (indexNode->
isDir());
671 d->fileInfoGatherer.list(
filePath(parent));
684 return d->root.visibleChildren.count();
695 return (parent.
column() > 0) ? 0 : 4;
708 return d->myComputer();
728 case 0:
return d->displayName(index);
729 case 1:
return d->size(index);
730 case 2:
return d->type(index);
731 case 3:
return d->time(index);
733 qWarning(
"data: invalid display value column %d", index.
column());
740 return d->name(index);
742 if (index.
column() == 0) {
743 QIcon icon =
d->icon(index);
745 if (
d->node(index)->isDir())
792 const qint64 mb = 1024 * kb;
793 const qint64 gb = 1024 * mb;
794 const qint64 tb = 1024 * gb;
813 #ifndef QT_NO_DATESTRING 828 return node(index)->type();
839 if (fileInfoGatherer.resolveSymlinks() && !resolvedSymLinks.isEmpty() &&
842 if (resolvedSymLinks.contains(fullPath))
843 return resolvedSymLinks[fullPath];
853 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) 855 if (!dirNode->volumeName.isNull())
868 return node(index)->icon();
892 #ifndef QT_NO_MESSAGEBOX 894 QFileSystemModel::tr(
"<b>The name \"%1\" can not be used.</b><p>Try using another name, with fewer characters or no punctuations marks.")
897 #endif // QT_NO_MESSAGEBOX 917 parentNode->
children[newName] = oldValue;
920 oldValue->
parent = parentNode;
921 oldValue->
populate(
d->fileInfoGatherer.getInfo(info));
924 parentNode->
children.remove(oldName);
958 case 0: returnValue =
tr(
"Name");
960 case 1: returnValue =
tr(
"Size");
962 case 2: returnValue =
964 tr(
"Kind",
"Match OS X Finder");
966 tr(
"Type",
"All other platforms");
973 case 3: returnValue =
tr(
"Date Modified");
991 if (
d->nameFilterDisables && !
d->passNameFilters(indexNode)) {
1002 if (indexNode->
isDir())
1014 q->sort(sortColumn, sortOrder);
1037 for (
int l1 = 0, l2 = 0; l1 <= s1.
count() && l2 <= s2.
count(); ++l1, ++l2) {
1052 int lookAheadLocation1 = l1;
1053 int lookAheadLocation2 = l2;
1054 int currentReturnValue = 0;
1057 QChar lookAhead1 = c1, lookAhead2 = c2;
1058 (lookAheadLocation1 <= s1.
length() && lookAheadLocation2 <= s2.
length());
1059 lookAhead1 =
getNextChar(s1, ++lookAheadLocation1),
1060 lookAhead2 =
getNextChar(s2, ++lookAheadLocation2)
1062 bool is1ADigit = !lookAhead1.
isNull() && lookAhead1.isDigit();
1063 bool is2ADigit = !lookAhead2.isNull() && lookAhead2.isDigit();
1064 if (!is1ADigit && !is2ADigit)
1070 if (currentReturnValue == 0) {
1071 if (lookAhead1 < lookAhead2) {
1072 currentReturnValue = -1;
1073 }
else if (lookAhead1 > lookAhead2) {
1074 currentReturnValue = 1;
1078 if (currentReturnValue != 0)
1079 return currentReturnValue;
1108 switch (sortColumn) {
1154 if (indexNode->
children.count() == 0)
1160 for(iterator = indexNode->
children.begin() ; iterator != indexNode->
children.end() ; ++iterator) {
1161 if (filtersAcceptsNode(iterator.
value())) {
1164 iterator.
value()->isVisible =
false;
1174 for (
int i = 0; i < values.
count(); ++i) {
1176 values.
at(i).first->isVisible =
true;
1179 if (!disableRecursiveSort) {
1180 for (
int i = 0; i < q->rowCount(parent); ++i) {
1181 const QModelIndex childIndex = q->index(i, 0, parent);
1185 sortChildren(column, childIndex);
1196 if (
d->sortOrder == order &&
d->sortColumn == column && !
d->forceSort)
1202 for (
int i = 0; i < oldList.
count(); ++i) {
1207 if (!(
d->sortColumn == column &&
d->sortOrder != order && !
d->forceSort)) {
1210 d->sortColumn = column;
1211 d->forceSort =
false;
1213 d->sortOrder = order;
1216 for (
int i = 0; i < oldNodes.
count(); ++i) {
1246 for (; it != indexes.
end(); ++
it)
1247 if ((*it).column() == 0)
1269 bool success =
true;
1278 QString path = (*it).toLocalFile();
1284 QString path = (*it).toLocalFile();
1290 QString path = (*it).toLocalFile();
1316 QString fullPath =
d->filePath(index);
1318 if (dirNode->
isSymLink() &&
d->fileInfoGatherer.resolveSymlinks()
1319 &&
d->resolvedSymLinks.contains(fullPath)
1320 && dirNode->
isDir()) {
1323 if (resolvedInfo.
exists())
1346 #if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) 1348 fullPath = fullPath.
mid(1);
1350 #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) 1367 if (!dir.
mkdir(name))
1375 return d->index(node);
1384 QFile::Permissions p =
d->node(index)->permissions();
1410 QString longNewPath = qt_GetLongPathName(newPath);
1415 QString longNewPath = newPath;
1417 QDir newPathDir(longNewPath);
1421 newPathDir.
setPath(longNewPath);
1424 d->setRootPath =
true;
1430 if (
d->rootDir.path() == longNewPath)
1433 bool showDrives = (longNewPath.
isEmpty() || longNewPath ==
d->myComputer());
1434 if (!showDrives && !newPathDir.
exists())
1440 d->fileInfoGatherer.removePath(
rootPath());
1444 d->node(
rootPath())->populatedChildren =
false;
1448 d->rootDir = newPathDir;
1454 newRootIndex =
d->index(newPathDir.
path());
1458 d->forceSort =
true;
1460 return newRootIndex;
1471 return d->rootDir.path();
1482 QDir dir(
d->rootDir);
1494 d->fileInfoGatherer.setIconProvider(provider);
1495 d->root.updateIcon(provider,
QString());
1504 return d->fileInfoGatherer.iconProvider();
1518 if (
d->filters == filters)
1523 d->forceSort =
true;
1555 d->fileInfoGatherer.setResolveSymlinks(enable);
1561 return d->fileInfoGatherer.resolveSymlinks();
1579 d->readOnly = enable;
1600 if (
d->nameFilterDisables == enable)
1602 d->nameFilterDisables = enable;
1603 d->forceSort =
true;
1610 return d->nameFilterDisables;
1619 #ifndef QT_NO_REGEXP 1622 if (!
d->bypassFilters.isEmpty()) {
1624 d->bypassFilters.clear();
1628 for (
int i = 0; i < persistantList.
count(); ++i) {
1630 node =
d->node(persistantList.
at(i));
1632 if (
d->bypassFilters.contains(node))
1635 d->bypassFilters[node] =
true;
1641 d->nameFilters.clear();
1644 for (
int i = 0; i < filters.
size(); ++i) {
1647 d->forceSort =
true;
1659 #ifndef QT_NO_REGEXP 1660 for (
int i = 0; i <
d->nameFilters.size(); ++i) {
1661 filters <<
d->nameFilters.at(i).pattern();
1674 d->root.retranslateStrings(
d->fileInfoGatherer.iconProvider(),
QString());
1700 if (parentNode->
children.count() == 0)
1703 #if defined(Q_OS_SYMBIAN) 1706 for(
int i = 0; i < files.
size(); i++) {
1714 while (i != parentNode->
children.constEnd()) {
1717 #if defined(Q_OS_SYMBIAN) 1718 i.value()->fileName.toLower());
1720 i.value()->fileName);
1722 if (iterator == newFiles.
end()) {
1723 toRemove.
append(i.value()->fileName);
1727 for (
int i = 0 ; i < toRemove.
count() ; ++i )
1728 removeNode(parentNode, toRemove[i]);
1742 #ifndef QT_NO_FILESYSTEMWATCHER 1745 #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) 1748 wchar_t name[MAX_PATH + 1];
1751 BOOL success = ::GetVolumeInformation((
wchar_t *)(nodeName.
utf16()),
1752 name, MAX_PATH + 1, NULL, 0, NULL, NULL, 0);
1753 if (success && name[0])
1757 parentNode->
children.insert(fileName, node);
1773 bool indexHidden = isHiddenByFilter(parentNode, parent);
1776 if (vLocation >= 0 && !indexHidden)
1777 q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation),
1778 translateVisibleLocation(parentNode, vLocation));
1784 if (vLocation >= 0 && !indexHidden)
1799 return sorter->compareNodes(parentNode->children.value(
name), parentNode->children.value(r));
1820 bool indexHidden = isHiddenByFilter(parentNode, parent);
1828 for (
int i = 0; i < newFiles.
count(); ++i) {
1830 parentNode->
children[newFiles.
at(i)]->isVisible =
true;
1846 if (vLocation == -1)
1849 bool indexHidden = isHiddenByFilter(parentNode, parent);
1851 q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation),
1852 translateVisibleLocation(parentNode, vLocation));
1875 for (
int i = 0; i < updates.count(); ++i) {
1879 bool previouslyHere = parentNode->
children.contains(fileName);
1880 if (!previouslyHere) {
1881 addNode(parentNode, fileName, info.fileInfo());
1885 if (isCaseSensitive) {
1886 if (node->fileName != fileName)
1892 if (isCaseSensitive) {
1893 Q_ASSERT(node->fileName == fileName);
1898 if (info.size() == -1 && !info.isSymLink()) {
1899 removeNode(parentNode, fileName);
1902 if (*node != info ) {
1903 node->populate(info);
1904 bypassFilters.remove(node);
1906 if (filtersAcceptsNode(node)) {
1907 if (!node->isVisible) {
1908 newFiles.
append(fileName);
1910 rowsToUpdate.
append(fileName);
1913 if (node->isVisible) {
1915 removeVisibleFile(parentNode, visibleLocation);
1927 for (
int i = 0; i < rowsToUpdate.
count(); ++i) {
1946 && visibleMin < parentNode->visibleChildren.count()
1948 && visibleMax >= 0) {
1949 QModelIndex bottom = q->index(translateVisibleLocation(parentNode, visibleMin), 0, parentIndex);
1950 QModelIndex top = q->index(translateVisibleLocation(parentNode, visibleMax), 3, parentIndex);
1951 emit q->dataChanged(bottom, top);
1958 if (newFiles.
count() > 0) {
1959 addVisibleFiles(parentNode, newFiles);
1962 if (newFiles.
count() > 0 || (sortColumn != 0 && rowsToUpdate.
count() > 0)) {
1973 resolvedSymLinks[
fileName] = resolvedName;
1982 qRegisterMetaType<QList<QPair<QString,QFileInfo> > >(
"QList<QPair<QString,QFileInfo> >");
1998 q->setRoleNames(roles);
2012 if (node->
parent == &root || bypassFilters.contains(node))
2036 if ( (hideHidden && !(isDot || isDotDot) && node->
isHidden())
2037 || (hideSystem && node->
isSystem())
2038 || (hideDirs && node->
isDir())
2039 || (hideFiles && node->
isFile())
2044 || (hideDot && isDot)
2045 || (hideDotDot && isDotDot))
2058 #ifndef QT_NO_REGEXP 2076 #include "moc_qfilesystemmodel.cpp" 2078 #endif // QT_NO_FILESYSTEMMODEL The QVariant class acts like a union for the most common Qt data types.
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
The QDir class provides access to directory structures and their contents.
void populate(const QExtendedInformation &fileInfo)
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
int columnCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
void removePath(const QString &path)
void * internalPointer() const
Returns a void * pointer used by the model to associate the index with the internal data structure...
QHash< QString, QFileSystemNode * > children
bool rename(const QString &newName)
Renames the file currently specified by fileName() to newName.
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
static int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
Natural number sort, skips spaces.
The QFileSystemModel class provides a data model for the local filesystem.
QString displayName(const QModelIndex &index) const
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
Reimplemented Function
QIcon icon(const QModelIndex &index) const
bool passNameFilters(const QFileSystemNode *node) const
static mach_timebase_info_data_t info
QModelIndexList persistentIndexList() const
Returns the list of indexes stored as persistent indexes in the model.
QString filePath(const QModelIndex &index) const
#define QT_END_NAMESPACE
This macro expands to.
bool canFetchMore(const QModelIndex &parent) const
Reimplemented Function
bool hasNext() const
Returns true if there is at least one more entry in the directory; otherwise, false is returned...
QString fileName(const QModelIndex &index) const
Returns the file name for the item stored in the model under the given index.
int digitValue() const
Returns the numeric value of the digit, or -1 if the character is not a digit.
const QChar at(int i) const
Returns the character at the given index position in the string.
QFileSystemModel(QObject *parent=0)
Constructs a file system model with the given parent.
The QRegExp class provides pattern matching using regular expressions.
qint64 size(const QModelIndex &index) const
Returns the size in bytes of index.
QVariant data(int role=Qt::DisplayRole) const
Returns the data for the given role for the item referred to by the index.
void directoryLoaded(const QString &path)
This signal is emitted when the gatherer thread has finished to load the path.
void rootPathChanged(const QString &newPath)
This signal is emitted whenever the root path has been changed to a newPath.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Reimplemented Function
QModelIndex sibling(int row, int column) const
Returns the sibling at row and column.
bool isNull() const
Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false...
#define it(className, varName)
QString name(const QModelIndex &index) const
int count(const T &t) const
Returns the number of occurrences of value in the vector.
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...
void setPath(const QString &path)
Sets the path of the directory to path.
void setNameFilterDisables(bool enable)
QString type(const QModelIndex &index) const
Returns the type of file index such as "Directory" or "JPEG file".
bool resolveSymlinks() const
void fill(uint pixel)
Fills the entire image with the given pixelValue.
bool filtersAcceptsNode(const QFileSystemNode *node) const
void chop(int n)
Removes n characters from the end of the string.
int length() const
Returns the number of characters in this string.
QString toUpper() const Q_REQUIRED_RESULT
Returns an uppercase copy of the string.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
QModelIndex createIndex(int row, int column, void *data=0) const
Creates a model index for the given row and column with the internal pointer ptr. ...
bool mkdir(const QString &dirName) const
Creates a sub-directory called dirName.
bool rmdir(const QModelIndex &index) const
Removes the directory corresponding to the model item index in the file system model and deletes the ...
bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
void insert(int i, const T &t)
Inserts value at index position i in the list.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool exists() const
Returns true if the file exists; otherwise returns false.
void pop_front()
This function is provided for STL compatibility.
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
int count(const T &t) const
Returns the number of occurrences of value in the list.
void fetchMore(const QModelIndex &parent)
Reimplemented Function
The QDirIterator class provides an iterator for directory entrylists.
The QString class provides a Unicode character string.
void removeVisibleFile(QFileSystemNode *parentNode, int visibleLocation)
QFileIconProvider * iconProvider() const
Returns the file icon provider for this directory model.
QDateTime lastModified() const
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Handles the data supplied by a drag and drop operation that ended with the given action over the row ...
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
static QChar separator()
Returns the native directory separator: "/" under Unix (including Mac OS X) and "\\" under Windows...
QFileSystemModelPrivate::QFileSystemNode * parentNode
The QChar class provides a 16-bit Unicode character.
QStringList nameFilters() const
Returns a list of filters applied to the names in the model.
void addVisibleFiles(QFileSystemNode *parentNode, const QStringList &newFiles)
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
bool exists() const
Returns true if the directory exists; otherwise returns false.
virtual 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.
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
void setNameFilters(const QStringList &nameFilters)
Sets the name filters used by entryList() and entryInfoList() to the list of filters specified by nam...
QFileSystemModelSorter(int column)
void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to)
Changes the QPersistentModelIndexes that is equal to the indexes in the given from model index list t...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
bool isLower() const
Returns true if the character is a lowercase letter, i.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
QFileSystemNode * node(const QModelIndex &index) const
Return the QFileSystemNode that goes to index.
QDateTime lastModified(const QModelIndex &index) const
Returns the date and time when index was last modified.
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
bool event(QEvent *event)
Reimplemented Function
QModelIndex mkdir(const QModelIndex &parent, const QString &name)
Create a directory with the name in the parent model index.
void sortChildren(int column, const QModelIndex &parent)
static QString toString(Register *reg, int type, bool *ok=0)
QFileSystemNode * addNode(QFileSystemNode *parentNode, const QString &fileName, const QFileInfo &info)
bool operator()(const QPair< QFileSystemModelPrivate::QFileSystemNode *, int > &l, const QPair< QFileSystemModelPrivate::QFileSystemNode *, int > &r) const
void append(const T &t)
Inserts value at the end of the list.
QString filePath(const QModelIndex &index) const
Returns the path of the item stored in the model under the index given.
bool rename(const QString &oldName, const QString &newName)
Renames a file or directory from oldName to newName, and returns true if successful; otherwise return...
Qt::DropActions supportedDropActions() const
Reimplemented Function
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool isEmpty(const char *str)
QList< Fetching > toFetch
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory; otherwise ret...
void layoutAboutToBeChanged()
This signal is emitted just before the layout of a model is changed.
void setIconProvider(QFileIconProvider *provider)
Sets the provider of file icons for the directory model.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void setNameFilters(const QStringList &filters)
Sets the name filters to apply against the existing files.
QString absolutePath() const
Returns the absolute path (a path that starts with "/" or with a drive specification), which may contain symbolic links, but never contains redundant ".", ".." or multiple separators.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
int row() const
Returns the row this model index refers to.
void prepend(const T &t)
Inserts value at the beginning of the list.
bool operator()(const QString &, QString r) const
const T & at(int i) const
Returns the item at index position i in the list.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
bool isDir(const QModelIndex &index) const
Returns true if the model item index represents a directory; otherwise returns false.
The QStringList class provides a list of strings.
bool hasInformation() const
const QFileSystemNode * node
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
void append(const T &t)
Inserts value at the end of the vector.
const T & value() const
Returns the current item's value.
Q_CORE_EXPORT void qWarning(const char *,...)
The QFileIconProvider class provides file icons for the QDirModel and the QFileSystemModel classes...
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
void setUrls(const QList< QUrl > &urls)
Sets the URLs stored in the MIME data object to those specified by urls.
~QFileSystemModel()
Destroys this file system model.
The QImage class provides a hardware-independent image representation that allows direct access to th...
bool nameFilterDisables() const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QVariant myComputer(int role=Qt::DisplayRole) const
Returns the data stored under the given role for the item "My Computer".
QImage createAlphaMask(Qt::ImageConversionFlags flags=Qt::AutoColor) const
Builds and returns a 1-bpp mask from the alpha buffer in this image.
QChar toUpper() const
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the ch...
void removeNode(QFileSystemNode *parentNode, const QString &name)
QList< QUrl > urls() const
Returns a list of URLs contained within the MIME data object.
void setFilter(QDir::Filters filters)
Sets the directory model's filter to that specified by filters.
void _q_performDelayedSort()
void clear()
Removes all items from the list.
void layoutChanged()
This signal is emitted whenever the layout of items exposed by the model has changed; for example...
QModelIndex setRootPath(const QString &path)
Sets the directory that is being watched by the model to newPath by installing a file system watcher ...
static QString cleanPath(const QString &path)
Removes all multiple directory separators "/" and resolves any "."s or ".."s found in the path...
QFile::Permissions permissions(const QModelIndex &index) const
Returns the complete OR-ed together combination of QFile::Permission for the index.
QHash< const QFileSystemNode *, bool > bypassFilters
QFileInfo fileInfo(const QModelIndex &index) const
Returns the QFileInfo for the item stored in the model under the given index.
The QMimeData class provides a container for data that records information about its MIME type...
QList< QString > visibleChildren
void _q_fileSystemChanged(const QString &path, const QList< QPair< QString, QFileInfo > > &)
The thread has received new information about files, update and emit dataChanged if it has actually c...
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
void qSort(RandomAccessIterator start, RandomAccessIterator end)
int localeAwareCompare(const QString &s) const
QFile::Permissions permissions() const
void setResolveSymlinks(bool enable)
const T & at(int i) const
Returns the item at index position i in the vector.
void timerEvent(QTimerEvent *event)
Reimplemented Function
The QAbstractItemModel class provides the abstract interface for item model classes.
QString type(const QModelIndex &index) const
void qStableSort(RandomAccessIterator start, RandomAccessIterator end)
T & first()
Returns a reference to the first item in the list.
void _q_directoryChanged(const QString &directory, const QStringList &list)
Performed quick listing and see if any files have been added or removed, then fetch more information ...
QBasicTimer fetchingTimer
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
static const char *const filters[3]
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
QModelIndex index(const QString &path)
QString & append(QChar c)
QString next()
Advances the iterator to the next entry, and returns the file path of this new entry.
int compare(const QString &s) const
The QDateTime class provides date and time functions.
The QTimerEvent class contains parameters that describe a timer event.
iterator begin()
Returns an STL-style iterator pointing to the first item in the vector.
QString size(const QModelIndex &index) const
The QPersistentModelIndex class is used to locate data in a data model.
QString time(const QModelIndex &index) const
QObject * parent() const
Returns a pointer to the parent object.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Reimplemented Function
static QTestResult::TestLocation location
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
bool rmdir(const QString &dirName) const
Removes the directory specified by dirName.
The QModelIndex class is used to locate data in a data model.
Qt::ItemFlags flags(const QModelIndex &index) const
Reimplemented Function
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
int size() const
Returns the number of items in the list.
QDir rootDirectory() const
The currently set directory.
static QChar getNextChar(const QString &s, int location)
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
Opens an information message box with the given title and text in front of the specified parent widge...
const QObjectList & children() const
Returns a list of child objects.
QMimeData * mimeData(const QModelIndexList &indexes) const
Returns an object that contains a serialized description of the specified indexes.
bool copy(const QString &newName)
Copies the file currently specified by fileName() to a file called newName.
static QString rootPath()
Returns the absolute path of the root directory.
bool remove()
Removes the file specified by fileName().
int visibleLocation(QString childName)
bool isSymLink(bool ignoreNtfsSymLinks=false) const
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
void setReadOnly(bool enable)
int rowCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
QDir::Filters filter() const
Returns the filter specified for the directory model.
QFileSystemModelVisibleFinder(QFileSystemModelPrivate::QFileSystemNode *node, QFileSystemModelSorter *sorter)
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
static QString fromNativeSeparators(const QString &pathName)
Returns pathName using '/' as file separator.
QFileSystemModelSorter * sorter
QString path() const
Returns the path.
bool remove(const QModelIndex &index) const
Removes the model item index from the file system model and deletes the corresponding file from the f...
void setAlphaChannel(const QImage &alphaChannel)
Sets the alpha channel of this image to the given alphaChannel.
iterator insertMulti(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
QStringList mimeTypes() const
Returns a list of MIME types that can be used to describe a list of items in the model.
QString rootPath() const
The currently set root path.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
The QFileInfo class provides system-independent file information.
bool compareNodes(const QFileSystemModelPrivate::QFileSystemNode *l, const QFileSystemModelPrivate::QFileSystemNode *r) const
QString filePath() const
Returns the file name, including the path (which may be absolute or relative).
static QString toNativeSeparators(const QString &pathName)
Returns pathName with the '/' separators converted to separators that are appropriate for the underly...
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
bool isDigit() const
Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false...
bool caseSensitive() const
void setFilter(Filters filter)
Sets the filter used by entryList() and entryInfoList() to filters.
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.
bool link(const QString &newName)
Creates a link named linkName that points to the file currently specified by fileName().
QExtendedInformation * info
int column() const
Returns the column this model index refers to.
The QList class is a template class that provides lists.
QFileInfoGatherer fileInfoGatherer
bool isExecutable() const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Reimplemented Function
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
void _q_resolvedName(const QString &fileName, const QString &resolvedName)
The QIcon class provides scalable icons in different modes and states.
void removeAt(int i)
Removes the item at index position i.