Compatibility Members for QDir

以下成员源于类 QDir are part of the Qt compatibility layer. We advise against using them in new code.

公共函数

QString absFilePath (const QString & fileName , bool acceptAbsPath = true) const
QString absPath () const
void convertToAbs ()
QFileInfoList entryInfoList (const QString & nameFilter , Filters filters = NoFilter, SortFlags sort = NoSort) const
QStringList entryList (const QString & nameFilter , Filters filters = NoFilter, SortFlags sort = NoSort) const
bool matchAllDirs () const
bool mkdir (const QString & dirName , bool acceptAbsPath ) const
QString nameFilter () const
bool rmdir (const QString & dirName , bool acceptAbsPath ) const
void setMatchAllDirs (bool on )
void setNameFilter (const QString & nameFilter )

静态公共成员

QString cleanDirPath (const QString & name )
QString currentDirPath ()
QString homeDirPath ()
QString rootDirPath ()

成员函数文档编制

QString QDir:: absFilePath (const QString & fileName , bool acceptAbsPath = true) const

使用 absoluteFilePath ( fileName ) 代替。

The acceptAbsPath 参数被忽略。

QString QDir:: absPath () const

使用 absolutePath () 代替。

[static] QString QDir:: cleanDirPath (const QString & name )

使用 cleanPath () 代替。

void QDir:: convertToAbs ()

使用 makeAbsolute () 代替。

[static] QString QDir:: currentDirPath ()

Returns the absolute path of the application's current directory.

使用 currentPath () 代替。

另请参阅 currentPath () 和 setCurrent ().

QFileInfoList QDir:: entryInfoList (const QString & nameFilter , 过滤器 filters = NoFilter, SortFlags sort = NoSort) const

这是重载函数。

Use the overload that takes a name filter string list as first argument instead of a combination of attribute filter flags.

QStringList QDir:: entryList (const QString & nameFilter , 过滤器 filters = NoFilter, SortFlags sort = NoSort) const

这是重载函数。

Use the overload that takes a name filter string list as first argument instead of a combination of attribute filter flags.

[static] QString QDir:: homeDirPath ()

Returns the absolute path of the user's home directory.

使用 homePath () 代替。

另请参阅 homePath ().

bool QDir:: matchAllDirs () const

使用 filter () & AllDirs 代替。

另请参阅 setMatchAllDirs ().

bool QDir:: mkdir (const QString & dirName , bool acceptAbsPath ) const

Use mkdir( dirName ) 代替。

The acceptAbsPath 参数被忽略。

QString QDir:: nameFilter () const

使用 nameFilters () 代替。

另请参阅 setNameFilter ().

bool QDir:: rmdir (const QString & dirName , bool acceptAbsPath ) const

Use rmdir( dirName ) 代替。

The acceptAbsPath 参数被忽略。

[static] QString QDir:: rootDirPath ()

Returns the absolute path of the root directory.

使用 rootPath () 代替。

另请参阅 rootPath ().

void QDir:: setMatchAllDirs ( bool on )

使用 setFilter () 代替。

另请参阅 matchAllDirs ().

void QDir:: setNameFilter (const QString & nameFilter )

使用 setNameFilters () 代替。

The nameFilter is a wildcard (globbing) filter that understands "*" and "?" wildcards. (See QRegExp wildcard matching .) You may specify several filter entries, each separated by spaces or by semicolons.

For example, if you want entryList () 和 entryInfoList () to list all files ending with either ".cpp" or ".h", you would use either dir. setNameFilters ("*.cpp *.h") or dir. setNameFilters ("*.cpp;*.h").

例如,若有代码像

QString filter = "*.cpp *.cxx *.cc";
dir.setNameFilter(filter);
					

可以把它重写成

QString filter = "*.cpp *.cxx *.cc";
dir.setNameFilters(filter.split(' '));
					

另请参阅 nameFilter ().