Address Qt 5 to-do comments related to QFileSystemModel.
- QFileSystemModel::rmdir() and QFileSystemModel::remove() changed to non-const -- they don't change the object, but they do change the file system, and the Qt way is to be non-const if having side-effects on external entities. - The comment on incompatibility between entryList and QFileInfo will not be fixed as doing so is likely to break existing code. - The comment on removing the internal resolvedSymLinks variable has been removed, as the variable is still used. Task-number: QTBUG-25088 Change-Id: I20456e4d116076403d9c4d4692ee05c178a1ed17 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
4f929e01e0
commit
94519a441c
@ -129,7 +129,7 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QFileSystemModel::rmdir(const QModelIndex &index) const
|
||||
\fn bool QFileSystemModel::rmdir(const QModelIndex &index)
|
||||
|
||||
Removes the directory corresponding to the model item \a index in the
|
||||
file system model and \b{deletes the corresponding directory from the
|
||||
@ -185,7 +185,7 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QFileSystemModel::remove(const QModelIndex &index) const
|
||||
\fn bool QFileSystemModel::remove(const QModelIndex &index)
|
||||
|
||||
Removes the model item \a index from the file system model and \b{deletes the
|
||||
corresponding file from the file system}, returning true if successful. If the
|
||||
@ -197,7 +197,7 @@ QT_BEGIN_NAMESPACE
|
||||
\sa rmdir()
|
||||
*/
|
||||
|
||||
bool QFileSystemModel::remove(const QModelIndex &aindex) const
|
||||
bool QFileSystemModel::remove(const QModelIndex &aindex)
|
||||
{
|
||||
//### TODO optim
|
||||
QString path = filePath(aindex);
|
||||
@ -1653,7 +1653,7 @@ bool QFileSystemModel::event(QEvent *event)
|
||||
return QAbstractItemModel::event(event);
|
||||
}
|
||||
|
||||
bool QFileSystemModel::rmdir(const QModelIndex &aindex) const
|
||||
bool QFileSystemModel::rmdir(const QModelIndex &aindex)
|
||||
{
|
||||
QString path = filePath(aindex);
|
||||
QFileSystemModelPrivate * d = const_cast<QFileSystemModelPrivate*>(d_func());
|
||||
@ -1985,8 +1985,7 @@ bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) co
|
||||
const bool hideDot = (filters & QDir::NoDot);
|
||||
const bool hideDotDot = (filters & QDir::NoDotDot);
|
||||
|
||||
// Note that we match the behavior of entryList and not QFileInfo on this and this
|
||||
// incompatibility won't be fixed until Qt 5 at least
|
||||
// Note that we match the behavior of entryList and not QFileInfo on this.
|
||||
bool isDot = (node->fileName == QLatin1String("."));
|
||||
bool isDotDot = (node->fileName == QLatin1String(".."));
|
||||
if ( (hideHidden && !(isDot || isDotDot) && node->isHidden())
|
||||
|
@ -138,12 +138,12 @@ public:
|
||||
QDateTime lastModified(const QModelIndex &index) const;
|
||||
|
||||
QModelIndex mkdir(const QModelIndex &parent, const QString &name);
|
||||
bool rmdir(const QModelIndex &index) const; // ### Qt5: should not be const
|
||||
bool rmdir(const QModelIndex &index);
|
||||
inline QString fileName(const QModelIndex &index) const;
|
||||
inline QIcon fileIcon(const QModelIndex &index) const;
|
||||
QFile::Permissions permissions(const QModelIndex &index) const;
|
||||
inline QFileInfo fileInfo(const QModelIndex &index) const;
|
||||
bool remove(const QModelIndex &index) const;
|
||||
bool remove(const QModelIndex &index);
|
||||
|
||||
protected:
|
||||
QFileSystemModel(QFileSystemModelPrivate &, QObject *parent = 0);
|
||||
|
@ -315,7 +315,6 @@ public:
|
||||
#ifndef QT_NO_REGEXP
|
||||
QList<QRegExp> nameFilters;
|
||||
#endif
|
||||
// ### Qt 5: resolvedSymLinks goes away
|
||||
QHash<QString, QString> resolvedSymLinks;
|
||||
|
||||
QFileSystemNode root;
|
||||
|
Loading…
Reference in New Issue
Block a user