#include <QtCore/QFile>

More information will be added here shortly. For now, you'll find more extensive information about this class in the Qt reference for QFile



Public Types Index


enum FileError

NoError 0, ReadError 1, WriteError 2, FatalError 3, ResourceError 4, OpenError 5, AbortError 6, TimeOutError 7, UnspecifiedError 8, RemoveError 9, RenameError 10, PositionError 11, ResizeError 12, PermissionsError 13, CopyError 14

enum FileHandleFlag

AutoCloseHandle 0x0001, DontCloseHandle 0

enum MemoryMapFlags

NoOptions 0

enum Permission

ReadOwner 0x4000, WriteOwner 0x2000, ExeOwner 0x1000, ReadUser 0x0400, WriteUser 0x0200, ExeUser 0x0100, ReadGroup 0x0040, WriteGroup 0x0020, ExeGroup 0x0010, ReadOther 0x0004, WriteOther 0x0002, ExeOther 0x0001

enum OpenModeFlag

NotOpen 0x0000, ReadOnly 0x0001, WriteOnly 0x0002, ReadWrite ReadOnly | WriteOnly, Append 0x0004, Truncate 0x0008, Text 0x0010, Unbuffered 0x0020

Public Functions Index

QFile ()
QFile (const QString &name)
QFile (QObject *parent)
QFile (const QString &name, QObject *parent)
~QFile ()
virtual boolatEnd () const
virtual voidclose ()
boolcopy (const QString &newName)
FileErrorerror () const
boolexists () const
virtual QAbstractFileEngine *fileEngine () const
QStringfileName () const
boolflush ()
inthandle () const
virtual boolisSequential () const
boollink (const QString &newName)
uchar *map (qint64 offset, qint64 size, MemoryMapFlags flags=NoOptions)
virtual boolopen (OpenMode flags)
boolopen (FILE *f, OpenMode flags)
boolopen (int fd, OpenMode flags)
boolopen (FILE *f, OpenMode ioFlags, FileHandleFlags handleFlags)
boolopen (int fd, OpenMode ioFlags, FileHandleFlags handleFlags)
Permissionspermissions () const
virtual qint64pos () const
QStringreadLink () const
boolremove ()
boolrename (const QString &newName)
boolresize (qint64 sz)
virtual boolseek (qint64 offset)
voidsetFileName (const QString &name)
boolsetPermissions (Permissions permissionSpec)
virtual qint64size () const
QStringsymLinkTarget () const
boolunmap (uchar *address)
voidunsetError ()
virtual qint64bytesAvailable () const Inherited
virtual qint64bytesToWrite () const Inherited
virtual boolcanReadLine () const Inherited
QStringerrorString () const Inherited
boolgetChar (char *c)Inherited
boolisOpen () const Inherited
boolisReadable () const Inherited
boolisTextModeEnabled () const Inherited
boolisWritable () const Inherited
OpenModeopenMode () const Inherited
qint64peek (char *data, qint64 maxlen)Inherited
QByteArraypeek (qint64 maxlen)Inherited
boolputChar (char c)Inherited
QIODevice ()Inherited
QIODevice (QObject *parent)Inherited
qint64read (char *data, qint64 maxlen)Inherited
QByteArrayread (qint64 maxlen)Inherited
QByteArrayreadAll ()Inherited
qint64readLine (char *data, qint64 maxlen)Inherited
QByteArrayreadLine (qint64 maxlen=0)Inherited
virtual boolreset ()Inherited
voidsetTextModeEnabled (bool enabled)Inherited
voidungetChar (char c)Inherited
virtual boolwaitForBytesWritten (int msecs)Inherited
virtual boolwaitForReadyRead (int msecs)Inherited
qint64write (const char *data, qint64 len)Inherited
qint64write (const char *data)Inherited
qint64write (const QByteArray &data)Inherited

Static Public Functions Index

boolcopy (const QString &fileName, const QString &newName)
QStringdecodeName (const QByteArray &localFileName)
QStringdecodeName (const char *localFileName)
QByteArrayencodeName (const QString &fileName)
boolexists (const QString &fileName)
boollink (const QString &oldname, const QString &newName)
Permissionspermissions (const QString &filename)
QStringreadLink (const QString &fileName)
boolremove (const QString &fileName)
boolrename (const QString &oldName, const QString &newName)
boolresize (const QString &filename, qint64 sz)
voidsetDecodingFunction (DecoderFn)
voidsetEncodingFunction (EncoderFn)
boolsetPermissions (const QString &filename, Permissions permissionSpec)
QStringsymLinkTarget (const QString &fileName)

Protected Functions Index

QFile (QFilePrivate &dd, QObject *parent=0)
virtual qint64readData (char *data, qint64 maxlen)
virtual qint64readLineData (char *data, qint64 maxlen)
virtual qint64writeData (const char *data, qint64 len)
QIODevice (QIODevicePrivate &dd, QObject *parent=0)Inherited
voidsetErrorString (const QString &errorString)Inherited
voidsetOpenMode (OpenMode openMode)Inherited

Signals Index

Only has inherited signals

voidaboutToClose ()Inherited
voidbytesWritten (qint64 bytes)Inherited
voidreadChannelFinished ()Inherited
voidreadyRead ()Inherited

Public Types

typedef QString(* DecoderFn

typedef QByteArray(* EncoderFn


NoError 0
ReadError 1
WriteError 2
FatalError 3
ResourceError 4
OpenError 5
AbortError 6
TimeOutError 7
UnspecifiedError 8
RemoveError 9
RenameError 10
PositionError 11
ResizeError 12
PermissionsError 13
CopyError 14


AutoCloseHandle 0x0001
DontCloseHandle 0


NoOptions 0


ReadOwner 0x4000
WriteOwner 0x2000
ExeOwner 0x1000
ReadUser 0x0400
WriteUser 0x0200
ExeUser 0x0100
ReadGroup 0x0040
WriteGroup 0x0020
ExeGroup 0x0010
ReadOther 0x0004
WriteOther 0x0002
ExeOther 0x0001

OpenModeFlag Inherited

NotOpen 0x0000
ReadOnly 0x0001
WriteOnly 0x0002
ReadWrite ReadOnly | WriteOnly
Append 0x0004
Truncate 0x0008
Text 0x0010
Unbuffered 0x0020

Public Functions

QFile ()

QFile (

QFile (

QFile (

~QFile ()


virtual bool atEnd ()

virtual void close ()

bool copy (

FileError error ()

bool exists ()

virtualQAbstractFileEngine * fileEngine ()

QString fileName ()

bool flush ()

int handle ()

virtual bool isSequential ()

uchar * map (
  • qint64offset,
  • qint64size,
  • MemoryMapFlagsflags )

virtual bool open (
  • OpenModeflags)

bool open (
  • FILE *f,
  • OpenModeflags )

bool open (
  • intfd,
  • OpenModeflags )

bool open (
  • FILE *f,
  • OpenModeioFlags,
  • FileHandleFlagshandleFlags )

bool open (
  • intfd,
  • OpenModeioFlags,
  • FileHandleFlagshandleFlags )

Permissions permissions ()

virtual qint64 pos ()

bool remove ()

bool rename (

bool resize (
  • qint64sz)

virtual bool seek (
  • qint64offset)

void setFileName (

bool setPermissions (
  • PermissionspermissionSpec)

virtual qint64 size ()

QString symLinkTarget ()

bool unmap (
  • uchar *address)

void unsetError ()

virtual qint64 bytesAvailable ()Inherited

virtual qint64 bytesToWrite ()Inherited

virtual bool canReadLine ()Inherited

QString errorString ()Inherited

bool getChar (
  • char *c)

bool isOpen ()Inherited

bool isReadable ()Inherited

bool isTextModeEnabled ()Inherited

bool isWritable ()Inherited

OpenMode openMode ()Inherited

qint64 peek (
  • char *data,
  • qint64maxlen )

QByteArray peek (
  • qint64maxlen)

bool putChar (
  • charc)

QIODevice ()Inherited

QIODevice (Inherited

qint64 read (
  • char *data,
  • qint64maxlen )

QByteArray read (
  • qint64maxlen)

QByteArray readAll ()Inherited

qint64 readLine (
  • char *data,
  • qint64maxlen )

QByteArray readLine (
  • qint64maxlen)

virtual bool reset ()Inherited

void setTextModeEnabled (
  • boolenabled)

void ungetChar (
  • charc)

virtual bool waitForBytesWritten (
  • intmsecs)

virtual bool waitForReadyRead (
  • intmsecs)

qint64 write (
  • const char *data,
  • qint64len )

qint64 write (
  • const char *data)

qint64 write (Inherited

Static Public Functions

bool copy (

QString decodeName (

QString decodeName (
  • const char *localFileName)

QByteArray encodeName (

bool exists (

Permissions permissions (

bool remove (

bool rename (

bool resize (
  • const QString &filename,
  • qint64sz )

void setDecodingFunction (
  • DecoderFn)

void setEncodingFunction (
  • EncoderFn)

bool setPermissions (
  • const QString &filename,
  • PermissionspermissionSpec )

QString symLinkTarget (

Protected Functions

QFile (
  • QFilePrivate &dd,
  • QObject *parent )

virtual qint64 readData (
  • char *data,
  • qint64maxlen )

virtual qint64 readLineData (
  • char *data,
  • qint64maxlen )

virtual qint64 writeData (
  • const char *data,
  • qint64len )

QIODevice (
  • QIODevicePrivate &dd,
  • QObject *parent )

void setErrorString (Inherited

void setOpenMode (
  • OpenModeopenMode)


(Only has inherited signals)

void aboutToClose ()Inherited

void bytesWritten (
  • qint64bytes)

void readChannelFinished ()Inherited

void readyRead ()Inherited

Last modified: 2015-07-24

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus