⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qdir.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
📖 第 1 页 / 共 3 页
字号:
'\" t.TH QDir 3qt "11 October 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQDir \- Access to directory structures and their contents in a platform-independent way.PP\fC#include <qdir.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBFilterSpec\fR { Dirs = 0x001, Files = 0x002, Drives = 0x004, NoSymLinks = 0x008, All = 0x007, TypeMask = 0x00F, Readable = 0x010, Writable = 0x020, Executable = 0x040, RWEMask = 0x070, Modified = 0x080, Hidden = 0x100, System = 0x200, AccessMask = 0x3F0, DefaultFilter = -1 }".br.ti -1c.BI "enum \fBSortSpec\fR { Name = 0x00, Time = 0x01, Size = 0x02, Unsorted = 0x03, SortByMask = 0x03, DirsFirst = 0x04, Reversed = 0x08, IgnoreCase = 0x10, DefaultSort = -1 }".br.ti -1c.BI "\fBQDir\fR ()".br.ti -1c.BI "\fBQDir\fR ( const QString & path, const QString & nameFilter = QString::null, int sortSpec = Name | IgnoreCase, int filterSpec = All )".br.ti -1c.BI "\fBQDir\fR ( const QDir & d )".br.ti -1c.BI "virtual \fB~QDir\fR ()".br.ti -1c.BI "QDir & \fBoperator=\fR ( const QDir & d )".br.ti -1c.BI "QDir & \fBoperator=\fR ( const QString & path )".br.ti -1c.BI "virtual void \fBsetPath\fR ( const QString & path )".br.ti -1c.BI "virtual QString \fBpath\fR () const".br.ti -1c.BI "virtual QString \fBabsPath\fR () const".br.ti -1c.BI "virtual QString \fBcanonicalPath\fR () const".br.ti -1c.BI "virtual QString \fBdirName\fR () const".br.ti -1c.BI "virtual QString \fBfilePath\fR ( const QString & fileName, bool acceptAbsPath = TRUE ) const".br.ti -1c.BI "virtual QString \fBabsFilePath\fR ( const QString & fileName, bool acceptAbsPath = TRUE ) const".br.ti -1c.BI "virtual bool \fBcd\fR ( const QString & dirName, bool acceptAbsPath = TRUE )".br.ti -1c.BI "virtual bool \fBcdUp\fR ()".br.ti -1c.BI "QString \fBnameFilter\fR () const".br.ti -1c.BI "virtual void \fBsetNameFilter\fR ( const QString & nameFilter )".br.ti -1c.BI "FilterSpec \fBfilter\fR () const".br.ti -1c.BI "virtual void \fBsetFilter\fR ( int filterSpec )".br.ti -1c.BI "SortSpec \fBsorting\fR () const".br.ti -1c.BI "virtual void \fBsetSorting\fR ( int sortSpec )".br.ti -1c.BI "bool \fBmatchAllDirs\fR () const".br.ti -1c.BI "virtual void \fBsetMatchAllDirs\fR ( bool enable )".br.ti -1c.BI "uint \fBcount\fR () const".br.ti -1c.BI "QString \fBoperator[]\fR ( int index ) const".br.ti -1c.BI "virtual QStrList encodedEntryList ( int filterSpec = DefaultFilter, int sortSpec = DefaultSort ) const  \fI(obsolete)\fR".br.ti -1c.BI "virtual QStrList encodedEntryList ( const QString & nameFilter, int filterSpec = DefaultFilter, int sortSpec = DefaultSort ) const  \fI(obsolete)\fR".br.ti -1c.BI "virtual QStringList \fBentryList\fR ( int filterSpec = DefaultFilter, int sortSpec = DefaultSort ) const".br.ti -1c.BI "virtual QStringList \fBentryList\fR ( const QString & nameFilter, int filterSpec = DefaultFilter, int sortSpec = DefaultSort ) const".br.ti -1c.BI "virtual const QFileInfoList * \fBentryInfoList\fR ( int filterSpec = DefaultFilter, int sortSpec = DefaultSort ) const".br.ti -1c.BI "virtual const QFileInfoList * \fBentryInfoList\fR ( const QString & nameFilter, int filterSpec = DefaultFilter, int sortSpec = DefaultSort ) const".br.ti -1c.BI "virtual bool \fBmkdir\fR ( const QString & dirName, bool acceptAbsPath = TRUE ) const".br.ti -1c.BI "virtual bool \fBrmdir\fR ( const QString & dirName, bool acceptAbsPath = TRUE ) const".br.ti -1c.BI "virtual bool \fBisReadable\fR () const".br.ti -1c.BI "virtual bool \fBexists\fR () const".br.ti -1c.BI "virtual bool \fBisRoot\fR () const".br.ti -1c.BI "virtual bool \fBisRelative\fR () const".br.ti -1c.BI "virtual void \fBconvertToAbs\fR ()".br.ti -1c.BI "virtual bool \fBoperator==\fR ( const QDir & d ) const".br.ti -1c.BI "virtual bool \fBoperator!=\fR ( const QDir & d ) const".br.ti -1c.BI "virtual bool \fBremove\fR ( const QString & fileName, bool acceptAbsPath = TRUE )".br.ti -1c.BI "virtual bool \fBrename\fR ( const QString & oldName, const QString & newName, bool acceptAbsPaths = TRUE )".br.ti -1c.BI "virtual bool \fBexists\fR ( const QString & name, bool acceptAbsPath = TRUE )".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QString \fBconvertSeparators\fR ( const QString & pathName )".br.ti -1c.BI "const QFileInfoList * \fBdrives\fR ()".br.ti -1c.BI "char \fBseparator\fR ()".br.ti -1c.BI "bool \fBsetCurrent\fR ( const QString & path )".br.ti -1c.BI "QDir \fBcurrent\fR ()".br.ti -1c.BI "QDir \fBhome\fR ()".br.ti -1c.BI "QDir \fBroot\fR ()".br.ti -1c.BI "QString \fBcurrentDirPath\fR ()".br.ti -1c.BI "QString \fBhomeDirPath\fR ()".br.ti -1c.BI "QString \fBrootDirPath\fR ()".br.ti -1c.BI "bool \fBmatch\fR ( const QStringList & filters, const QString & fileName )".br.ti -1c.BI "bool \fBmatch\fR ( const QString & filter, const QString & fileName )".br.ti -1c.BI "QString \fBcleanDirPath\fR ( const QString & filePath )".br.ti -1c.BI "bool \fBisRelativePath\fR ( const QString & path )".br.in -1c.SH DESCRIPTIONThe QDir class provides access to directory structures and their contents in a platform-independent way..PPA QDir is used to manipulate path names, access information regarding paths and files, and manipulate the underlying file system..PPA QDir can point to a file using either a relative or an absolute file path. Absolute file paths begin with the directory separator "/" or with a drive specification (except under Unix). If you always use "/" as a directory separator, Qt will translate your paths to conform to the underlying operating system. Relative file names begin with a directory name or a file name and specify a path relative to the current directory..PPThe "current" path refers to the application's working directory. A QDir's own path is set and retrieved with setPath() and path()..PPAn example of an absolute path is the string "/tmp/quartz", a relative path might look like "src/fatlib". You can use the function isRelative() to check if a QDir is using a relative or an absolute file path. Call convertToAbs() to convert a relative QDir to an absolute one. For a simplified path use cleanDirPath(). To obtain a path which has no symbolic links or redundant ".." elements use canonicalPath(). The path can be set with setPath(), or changed with cd() and cdUp()..PPQDir provides several static functions, for example, setCurrent() to set the application's working directory and currentDirPath() to retrieve the application's working directory. Access to some common paths is provided with the static functions, current(), home() and root() which return QDir objects or currentDirPath(), homeDirPath() and rootDirPath() which return the path as a string..PPThe number of entries in a directory is returned by count(). Obtain a string list of the names of all the files and directories in a directory with entryList(). If you prefer a list of QFileInfo pointers use entryInfoList(). Both these functions can apply a name filter, an attributes filter (e.g. read-only, files not directories, etc.), and a sort order. The filters and sort may be set with calls to setNameFilter(), setFilter() and setSorting(). They may also be specified in the entryList() and entryInfoList()'s arguments..PPCreate a new directory with mkdir(), rename a directory with rename() and remove an existing directory with rmdir(). Remove a file with remove(). You can interrogate a directory with exists(), isReadable() and isRoot()..PPTo get a path with a filename use filePath(), and to get a directory name use dirName(); neither of these functions checks for the existence of the file or directory..PPThe list of root directories is provided by drives(); on Unix systems this returns a list containing one root directory, "/"; on Windows the list will usually contain "C:/", and possibly "D:/", etc..PPIf you need the path in a form suitable for the underlying operating system use convertSeparators()..PPExamples:.)l.PPSee if a directory exists..PP.nf.br    QDir d( "example" );                        // "./example".br    if ( !d.exists() ).br        qWarning( "Cannot find the example directory" );.br.fi.PPTraversing directories and reading a file..PP.nf.br    QDir d = QDir::root();                      // "/".br    if ( !d.cd("tmp") ) {                       // "/tmp".br        qWarning( "Cannot find the \\"/tmp\\" directory" );.br    } else {.br        QFile f( d.filePath("ex1.txt") );       // "/tmp/ex1.txt".br        if ( !f.open(IO_ReadWrite) ).br            qWarning( "Cannot create the file %s", f.name() );.br    }.br.fi.PPA program that lists all the files in the current directory (excluding symbolic links), sorted by size, smallest first..PP.nf.br    #include <stdio.h>.br    #include <qdir.h>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -