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

void QFile::setFileName ( const QString name ) [inherited]

Sets the name of the file. The name can have no path, a relative path, or an absolute path.

Do not call this function if the file has already been opened.

If the file name has no path or a relative path, the path used will be the application's current directory path {at the time of the open()} call.

Example: doc/src/snippets/code/src_corelib_io_qfile.cpp 0

Note that the directory separator "/" works for all operating systems supported by Qt.

See also:
fileName(), QFileInfo, QDir

Definition at line 448 of file qfile.cpp.

References QFile::close(), QFile::fileName(), and QIODevice::isOpen().

Referenced by QueryMainWindow::evaluate(), Config::load(), QueryMainWindow::loadInputFile(), QHostInfo::localDomainName(), QPictureIO::read(), QFile::rename(), and QPictureIO::write().

    if (isOpen()) {
        qWarning("QFile::setFileName: File (%s) is already opened",
    if(d->fileEngine) { //get a new file engine later
        delete d->fileEngine;
        d->fileEngine = 0;
    d->fileName = name;

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