Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

bool QFile::remove (  ) [inherited]

Removes the file specified by fileName(). Returns true if successful; otherwise returns false.

The file is closed before it is removed.

See also:
setFileName()

Definition at line 646 of file qfile.cpp.

References QFile::close(), QFile::error(), QFile::fileEngine(), and QFile::unsetError().

Referenced by SaveFormAsTemplate::accept(), QSystemSemaphorePrivate::cleanHandle(), QDirModel::dropMimeData(), QNetworkDiskCache::expire(), QFile::remove(), QNetworkDiskCachePrivate::removeFile(), and QFile::rename().

{
    Q_D(QFile);
    if (d->fileName.isEmpty()) {
        qWarning("QFile::remove: Empty or null file name");
        return false;
    }
    close();
    if(error() == QFile::NoError) {
        if(fileEngine()->remove()) {
            unsetError();
            return true;
        }
#if defined(Q_OS_WIN)
        d->setError(QFile::RemoveError, GetLastError());
#else
        d->setError(QFile::RemoveError, errno);
#endif
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index