KLayout 0.29.8 (2024-11-26 926dac96c) [master]

API reference - Class QFile

Notation used in Ruby API documentation

Module: QtCore

Description: Binding of QFile

Class hierarchy: QFile » QFileDevice » QIODevice » QObject

Public constructors

new QFilenewConstructor QFile::QFile()
new QFilenew(string name)Constructor QFile::QFile(const QString &name)
new QFilenew(QObject ptr parent)Constructor QFile::QFile(QObject *parent)
new QFilenew(string name,
QObject ptr parent)
Constructor QFile::QFile(const QString &name, QObject *parent)

Public methods

[const]QFile ptr_const_castReturns a non-const reference to self.
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
[signal]voidaboutToCloseSignal declaration for QFile::aboutToClose()
[signal]voidbytesWritten(long long bytes)Signal declaration for QFile::bytesWritten(qint64 bytes)
[signal]voidchannelBytesWritten(int channel,
long long bytes)
Signal declaration for QFile::channelBytesWritten(int channel, qint64 bytes)
[signal]voidchannelReadyRead(int channel)Signal declaration for QFile::channelReadyRead(int channel)
boolcopy(string newName)Method bool QFile::copy(const QString &newName)
[signal]voiddestroyed(QObject ptr arg1)Signal declaration for QFile::destroyed(QObject *)
[const]boolexistsMethod bool QFile::exists()
[const]stringfileNameMethod QString QFile::fileName()
voidfileName=(string name)Method void QFile::setFileName(const QString &name)
boollink(string newName)Method bool QFile::link(const QString &newName)
[signal]voidobjectNameChanged(string objectName)Signal declaration for QFile::objectNameChanged(const QString &objectName)
boolopen(QIODevice_QFlags_OpenModeFlag flags)Method bool QFile::open(QFlags<QIODevice::OpenModeFlag> flags)
[const]QFileDevice_QFlags_PermissionpermissionsMethod QFlags<QFileDevice::Permission> QFile::permissions()
[signal]voidreadChannelFinishedSignal declaration for QFile::readChannelFinished()
[const]stringreadLinkMethod QString QFile::readLink()
[signal]voidreadyReadSignal declaration for QFile::readyRead()
boolremoveMethod bool QFile::remove()
boolrename(string newName)Method bool QFile::rename(const QString &newName)
boolresize(long long sz)Method bool QFile::resize(qint64 sz)
voidsetFileName(string name)Method void QFile::setFileName(const QString &name)
boolsetPermissions(QFileDevice_QFlags_Permission permissionSpec)Method bool QFile::setPermissions(QFlags<QFileDevice::Permission> permissionSpec)
[const]long longsizeMethod qint64 QFile::size()
[const]stringsymLinkTargetMethod QString QFile::symLinkTarget()

Public static methods and constants

boolcopy(string fileName,
string newName)
Static method bool QFile::copy(const QString &fileName, const QString &newName)
stringdecodeName(string localFileName)Static method QString QFile::decodeName(const char *localFileName)
bytesencodeName(string fileName)Static method QByteArray QFile::encodeName(const QString &fileName)
boolexists(string fileName)Static method bool QFile::exists(const QString &fileName)
boollink(string oldname,
string newName)
Static method bool QFile::link(const QString &oldname, const QString &newName)
QFileDevice_QFlags_Permissionpermissions(string filename)Static method QFlags<QFileDevice::Permission> QFile::permissions(const QString &filename)
stringreadLink(string fileName)Static method QString QFile::readLink(const QString &fileName)
boolremove(string fileName)Static method bool QFile::remove(const QString &fileName)
boolrename(string oldName,
string newName)
Static method bool QFile::rename(const QString &oldName, const QString &newName)
boolresize(string filename,
long long sz)
Static method bool QFile::resize(const QString &filename, qint64 sz)
boolsetPermissions(string filename,
QFileDevice_QFlags_Permission permissionSpec)
Static method bool QFile::setPermissions(const QString &filename, QFlags<QFileDevice::Permission> permissionSpec)
QMetaObjectstaticMetaObjectObtains the static MetaObject for this class.
stringsymLinkTarget(string fileName)Static method QString QFile::symLinkTarget(const QString &fileName)
stringtr(string s,
string c = nullptr,
int n = -1)
Static method QString QFile::tr(const char *s, const char *c, int n)
stringtrUtf8(string s,
string c = nullptr,
int n = -1)
Static method QString QFile::trUtf8(const char *s, const char *c, int n)

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

_const_cast

Signature: [const] QFile ptr _const_cast

Description: Returns a non-const reference to self.

Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects.

This method has been introduced in version 0.29.6.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

aboutToClose

Signature: [signal] void aboutToClose

Description: Signal declaration for QFile::aboutToClose()

You can bind a procedure to this signal.

Python specific notes:
The object exposes a readable attribute 'aboutToClose'. This is the getter.
The object exposes a writable attribute 'aboutToClose'. This is the setter.

bytesWritten

Signature: [signal] void bytesWritten (long long bytes)

Description: Signal declaration for QFile::bytesWritten(qint64 bytes)

You can bind a procedure to this signal.

Python specific notes:
The object exposes a readable attribute 'bytesWritten'. This is the getter.
The object exposes a writable attribute 'bytesWritten'. This is the setter.

channelBytesWritten

Signature: [signal] void channelBytesWritten (int channel, long long bytes)

Description: Signal declaration for QFile::channelBytesWritten(int channel, qint64 bytes)

You can bind a procedure to this signal.

Python specific notes:
The object exposes a readable attribute 'channelBytesWritten'. This is the getter.
The object exposes a writable attribute 'channelBytesWritten'. This is the setter.

channelReadyRead

Signature: [signal] void channelReadyRead (int channel)

Description: Signal declaration for QFile::channelReadyRead(int channel)

You can bind a procedure to this signal.

Python specific notes:
The object exposes a readable attribute 'channelReadyRead'. This is the getter.
The object exposes a writable attribute 'channelReadyRead'. This is the setter.

copy

(1) Signature: bool copy (string newName)

Description: Method bool QFile::copy(const QString &newName)

Python specific notes:
This instance method is available as '_inst_copy' in Python.

(2) Signature: [static] bool copy (string fileName, string newName)

Description: Static method bool QFile::copy(const QString &fileName, const QString &newName)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_copy' in Python.

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

decodeName

Signature: [static] string decodeName (string localFileName)

Description: Static method QString QFile::decodeName(const char *localFileName)

This method is static and can be called without an instance.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

destroyed

Signature: [signal] void destroyed (QObject ptr arg1)

Description: Signal declaration for QFile::destroyed(QObject *)

You can bind a procedure to this signal.

Python specific notes:
The object exposes a readable attribute 'destroyed'. This is the getter.
The object exposes a writable attribute 'destroyed'. This is the setter.

encodeName

Signature: [static] bytes encodeName (string fileName)

Description: Static method QByteArray QFile::encodeName(const QString &fileName)

This method is static and can be called without an instance.

exists

(1) Signature: [const] bool exists

Description: Method bool QFile::exists()

Python specific notes:
This instance method is available as '_inst_exists' in Python.

(2) Signature: [static] bool exists (string fileName)

Description: Static method bool QFile::exists(const QString &fileName)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_exists' in Python.

fileName

Signature: [const] string fileName

Description: Method QString QFile::fileName()

This is a reimplementation of QFileDevice::fileName

Python specific notes:
The object exposes a readable attribute 'fileName'. This is the getter.

fileName=

Signature: void fileName= (string name)

Description: Method void QFile::setFileName(const QString &name)

Python specific notes:
The object exposes a writable attribute 'fileName'. This is the setter.
The object exposes a writable attribute 'fileName'. This is the setter.

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

link

(1) Signature: bool link (string newName)

Description: Method bool QFile::link(const QString &newName)

Python specific notes:
This instance method is available as '_inst_link' in Python.

(2) Signature: [static] bool link (string oldname, string newName)

Description: Static method bool QFile::link(const QString &oldname, const QString &newName)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_link' in Python.

new

(1) Signature: [static] new QFile new

Description: Constructor QFile::QFile()

This method creates an object of class QFile.

Python specific notes:
This method is the default initializer of the object.

(2) Signature: [static] new QFile new (string name)

Description: Constructor QFile::QFile(const QString &name)

This method creates an object of class QFile.

Python specific notes:
This method is the default initializer of the object.

(3) Signature: [static] new QFile new (QObject ptr parent)

Description: Constructor QFile::QFile(QObject *parent)

This method creates an object of class QFile.

Python specific notes:
This method is the default initializer of the object.

(4) Signature: [static] new QFile new (string name, QObject ptr parent)

Description: Constructor QFile::QFile(const QString &name, QObject *parent)

This method creates an object of class QFile.

Python specific notes:
This method is the default initializer of the object.

objectNameChanged

Signature: [signal] void objectNameChanged (string objectName)

Description: Signal declaration for QFile::objectNameChanged(const QString &objectName)

You can bind a procedure to this signal.

Python specific notes:
The object exposes a readable attribute 'objectNameChanged'. This is the getter.
The object exposes a writable attribute 'objectNameChanged'. This is the setter.

open

Signature: bool open (QIODevice_QFlags_OpenModeFlag flags)

Description: Method bool QFile::open(QFlags<QIODevice::OpenModeFlag> flags)

This is a reimplementation of QIODevice::open

permissions

(1) Signature: [const] QFileDevice_QFlags_Permission permissions

Description: Method QFlags<QFileDevice::Permission> QFile::permissions()

This is a reimplementation of QFileDevice::permissions

Python specific notes:
This instance method is available as '_inst_permissions' in Python.

(2) Signature: [static] QFileDevice_QFlags_Permission permissions (string filename)

Description: Static method QFlags<QFileDevice::Permission> QFile::permissions(const QString &filename)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_permissions' in Python.

readChannelFinished

Signature: [signal] void readChannelFinished

Description: Signal declaration for QFile::readChannelFinished()

You can bind a procedure to this signal.

Python specific notes:
The object exposes a readable attribute 'readChannelFinished'. This is the getter.
The object exposes a writable attribute 'readChannelFinished'. This is the setter.

readLink

(1) Signature: [const] string readLink

Description: Method QString QFile::readLink()

Python specific notes:
This instance method is available as '_inst_readLink' in Python.

(2) Signature: [static] string readLink (string fileName)

Description: Static method QString QFile::readLink(const QString &fileName)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_readLink' in Python.

readyRead

Signature: [signal] void readyRead

Description: Signal declaration for QFile::readyRead()

You can bind a procedure to this signal.

Python specific notes:
The object exposes a readable attribute 'readyRead'. This is the getter.
The object exposes a writable attribute 'readyRead'. This is the setter.

remove

(1) Signature: bool remove

Description: Method bool QFile::remove()

Python specific notes:
This instance method is available as '_inst_remove' in Python.

(2) Signature: [static] bool remove (string fileName)

Description: Static method bool QFile::remove(const QString &fileName)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_remove' in Python.

rename

(1) Signature: bool rename (string newName)

Description: Method bool QFile::rename(const QString &newName)

Python specific notes:
This instance method is available as '_inst_rename' in Python.

(2) Signature: [static] bool rename (string oldName, string newName)

Description: Static method bool QFile::rename(const QString &oldName, const QString &newName)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_rename' in Python.

resize

(1) Signature: bool resize (long long sz)

Description: Method bool QFile::resize(qint64 sz)

This is a reimplementation of QFileDevice::resize

Python specific notes:
This instance method is available as '_inst_resize' in Python.

(2) Signature: [static] bool resize (string filename, long long sz)

Description: Static method bool QFile::resize(const QString &filename, qint64 sz)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_resize' in Python.

setFileName

Signature: void setFileName (string name)

Description: Method void QFile::setFileName(const QString &name)

Python specific notes:
The object exposes a writable attribute 'fileName'. This is the setter.
The object exposes a writable attribute 'fileName'. This is the setter.

setPermissions

(1) Signature: bool setPermissions (QFileDevice_QFlags_Permission permissionSpec)

Description: Method bool QFile::setPermissions(QFlags<QFileDevice::Permission> permissionSpec)

This is a reimplementation of QFileDevice::setPermissions

Python specific notes:
This instance method is available as '_inst_setPermissions' in Python.

(2) Signature: [static] bool setPermissions (string filename, QFileDevice_QFlags_Permission permissionSpec)

Description: Static method bool QFile::setPermissions(const QString &filename, QFlags<QFileDevice::Permission> permissionSpec)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_setPermissions' in Python.

size

Signature: [const] long long size

Description: Method qint64 QFile::size()

This is a reimplementation of QFileDevice::size

Python specific notes:
This method is also available as 'len(object)'.

staticMetaObject

Signature: [static] QMetaObject staticMetaObject

Description: Obtains the static MetaObject for this class.

symLinkTarget

(1) Signature: [const] string symLinkTarget

Description: Method QString QFile::symLinkTarget()

Python specific notes:
This instance method is available as '_inst_symLinkTarget' in Python.

(2) Signature: [static] string symLinkTarget (string fileName)

Description: Static method QString QFile::symLinkTarget(const QString &fileName)

This method is static and can be called without an instance.

Python specific notes:
This class method is available as '_class_symLinkTarget' in Python.

tr

Signature: [static] string tr (string s, string c = nullptr, int n = -1)

Description: Static method QString QFile::tr(const char *s, const char *c, int n)

This method is static and can be called without an instance.

trUtf8

Signature: [static] string trUtf8 (string s, string c = nullptr, int n = -1)

Description: Static method QString QFile::trUtf8(const char *s, const char *c, int n)

This method is static and can be called without an instance.