API reference - Class QIODevice

Notation used in Ruby API documentation

Module: QtCore

Description: Binding of QIODevice

Class hierarchy: QIODevice » QObject

Sub-classes: OpenModeFlag, QFlags_OpenModeFlag

Public constructors

new QIODevice ptrnewCreates a new object of this class

Public methods

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 QIODevice::aboutToClose()
[const]boolatEndMethod bool QIODevice::atEnd()
[const]long longbytesAvailableMethod qint64 QIODevice::bytesAvailable()
[const]long longbytesToWriteMethod qint64 QIODevice::bytesToWrite()
[signal]voidbytesWritten(long long bytes)Signal declaration for QIODevice::bytesWritten(qint64 bytes)
[const]boolcanReadLineMethod bool QIODevice::canReadLine()
voidcloseMethod void QIODevice::close()
[signal]voiddestroyed(QObject ptr arg1)Signal declaration for QIODevice::destroyed(QObject *)
[const]stringerrorStringMethod QString QIODevice::errorString()
[const]boolisOpen?Method bool QIODevice::isOpen()
[const]boolisReadable?Method bool QIODevice::isReadable()
[const]boolisSequential?Method bool QIODevice::isSequential()
[const]boolisTextModeEnabled?Method bool QIODevice::isTextModeEnabled()
[const]boolisWritable?Method bool QIODevice::isWritable()
[signal]voidobjectNameChanged(string objectName)Signal declaration for QIODevice::objectNameChanged(const QString &objectName)
boolopen(QIODevice_QFlags_OpenModeFlag mode)Method bool QIODevice::open(QFlags<QIODevice::OpenModeFlag> mode)
[const]QIODevice_QFlags_OpenModeFlagopenModeMethod QFlags<QIODevice::OpenModeFlag> QIODevice::openMode()
bytespeek(long long maxlen)Method QByteArray QIODevice::peek(qint64 maxlen)
[const]long longposMethod qint64 QIODevice::pos()
boolputChar(char c)Method bool QIODevice::putChar(char c)
bytesread(long long maxlen)Method QByteArray QIODevice::read(qint64 maxlen)
bytesreadAllMethod QByteArray QIODevice::readAll()
[signal]voidreadChannelFinishedSignal declaration for QIODevice::readChannelFinished()
bytesreadLine(long long maxlen = 0)Method QByteArray QIODevice::readLine(qint64 maxlen)
[signal]voidreadyReadSignal declaration for QIODevice::readyRead()
boolresetMethod bool QIODevice::reset()
boolseek(long long pos)Method bool QIODevice::seek(qint64 pos)
voidsetTextModeEnabled(bool enabled)Method void QIODevice::setTextModeEnabled(bool enabled)
[const]long longsizeMethod qint64 QIODevice::size()
[const]booltextModeEnabledMethod bool QIODevice::isTextModeEnabled()
voidtextModeEnabled=(bool enabled)Method void QIODevice::setTextModeEnabled(bool enabled)
voidungetChar(char c)Method void QIODevice::ungetChar(char c)
boolwaitForBytesWritten(int msecs)Method bool QIODevice::waitForBytesWritten(int msecs)
boolwaitForReadyRead(int msecs)Method bool QIODevice::waitForReadyRead(int msecs)
long longwrite(string data,
long long len)
Method qint64 QIODevice::write(const char *data, qint64 len)
long longwrite(bytes data)Method qint64 QIODevice::write(const QByteArray &data)

Public static methods and constants

[static,const]QIODevice_OpenModeFlagAppendEnum constant QIODevice::Append
[static,const]QIODevice_OpenModeFlagNotOpenEnum constant QIODevice::NotOpen
[static,const]QIODevice_OpenModeFlagReadOnlyEnum constant QIODevice::ReadOnly
[static,const]QIODevice_OpenModeFlagReadWriteEnum constant QIODevice::ReadWrite
[static,const]QIODevice_OpenModeFlagTextEnum constant QIODevice::Text
[static,const]QIODevice_OpenModeFlagTruncateEnum constant QIODevice::Truncate
[static,const]QIODevice_OpenModeFlagUnbufferedEnum constant QIODevice::Unbuffered
[static,const]QIODevice_OpenModeFlagWriteOnlyEnum constant QIODevice::WriteOnly
QMetaObjectstaticMetaObjectObtains the static MetaObject for this class.
stringtr(string s,
string c = nullptr,
int n = -1)
Static method QString QIODevice::tr(const char *s, const char *c, int n)
stringtrUtf8(string s,
string c = nullptr,
int n = -1)
Static method QString QIODevice::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

Append

Signature: [static,const] QIODevice_OpenModeFlag Append

Description: Enum constant QIODevice::Append

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

NotOpen

Signature: [static,const] QIODevice_OpenModeFlag NotOpen

Description: Enum constant QIODevice::NotOpen

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

ReadOnly

Signature: [static,const] QIODevice_OpenModeFlag ReadOnly

Description: Enum constant QIODevice::ReadOnly

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

ReadWrite

Signature: [static,const] QIODevice_OpenModeFlag ReadWrite

Description: Enum constant QIODevice::ReadWrite

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

Text

Signature: [static,const] QIODevice_OpenModeFlag Text

Description: Enum constant QIODevice::Text

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

Truncate

Signature: [static,const] QIODevice_OpenModeFlag Truncate

Description: Enum constant QIODevice::Truncate

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

Unbuffered

Signature: [static,const] QIODevice_OpenModeFlag Unbuffered

Description: Enum constant QIODevice::Unbuffered

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

WriteOnly

Signature: [static,const] QIODevice_OpenModeFlag WriteOnly

Description: Enum constant QIODevice::WriteOnly

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

_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 QIODevice::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.

atEnd

Signature: [const] bool atEnd

Description: Method bool QIODevice::atEnd()

bytesAvailable

Signature: [const] long long bytesAvailable

Description: Method qint64 QIODevice::bytesAvailable()

bytesToWrite

Signature: [const] long long bytesToWrite

Description: Method qint64 QIODevice::bytesToWrite()

bytesWritten

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

Description: Signal declaration for QIODevice::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.

canReadLine

Signature: [const] bool canReadLine

Description: Method bool QIODevice::canReadLine()

close

Signature: void close

Description: Method void QIODevice::close()

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.

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 QIODevice::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.

errorString

Signature: [const] string errorString

Description: Method QString QIODevice::errorString()

isOpen?

Signature: [const] bool isOpen?

Description: Method bool QIODevice::isOpen()

isReadable?

Signature: [const] bool isReadable?

Description: Method bool QIODevice::isReadable()

isSequential?

Signature: [const] bool isSequential?

Description: Method bool QIODevice::isSequential()

isTextModeEnabled?

Signature: [const] bool isTextModeEnabled?

Description: Method bool QIODevice::isTextModeEnabled()

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

isWritable?

Signature: [const] bool isWritable?

Description: Method bool QIODevice::isWritable()

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.

new

Signature: [static] new QIODevice ptr new

Description: Creates a new object of this class

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

objectNameChanged

Signature: [signal] void objectNameChanged (string objectName)

Description: Signal declaration for QIODevice::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 mode)

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

openMode

Signature: [const] QIODevice_QFlags_OpenModeFlag openMode

Description: Method QFlags<QIODevice::OpenModeFlag> QIODevice::openMode()

peek

Signature: bytes peek (long long maxlen)

Description: Method QByteArray QIODevice::peek(qint64 maxlen)

pos

Signature: [const] long long pos

Description: Method qint64 QIODevice::pos()

putChar

Signature: bool putChar (char c)

Description: Method bool QIODevice::putChar(char c)

read

Signature: bytes read (long long maxlen)

Description: Method QByteArray QIODevice::read(qint64 maxlen)

readAll

Signature: bytes readAll

Description: Method QByteArray QIODevice::readAll()

readChannelFinished

Signature: [signal] void readChannelFinished

Description: Signal declaration for QIODevice::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.

readLine

Signature: bytes readLine (long long maxlen = 0)

Description: Method QByteArray QIODevice::readLine(qint64 maxlen)

readyRead

Signature: [signal] void readyRead

Description: Signal declaration for QIODevice::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.

reset

Signature: bool reset

Description: Method bool QIODevice::reset()

seek

Signature: bool seek (long long pos)

Description: Method bool QIODevice::seek(qint64 pos)

setTextModeEnabled

Signature: void setTextModeEnabled (bool enabled)

Description: Method void QIODevice::setTextModeEnabled(bool enabled)

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

size

Signature: [const] long long size

Description: Method qint64 QIODevice::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.

textModeEnabled

Signature: [const] bool textModeEnabled

Description: Method bool QIODevice::isTextModeEnabled()

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

textModeEnabled=

Signature: void textModeEnabled= (bool enabled)

Description: Method void QIODevice::setTextModeEnabled(bool enabled)

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

tr

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

Description: Static method QString QIODevice::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 QIODevice::trUtf8(const char *s, const char *c, int n)

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

ungetChar

Signature: void ungetChar (char c)

Description: Method void QIODevice::ungetChar(char c)

waitForBytesWritten

Signature: bool waitForBytesWritten (int msecs)

Description: Method bool QIODevice::waitForBytesWritten(int msecs)

waitForReadyRead

Signature: bool waitForReadyRead (int msecs)

Description: Method bool QIODevice::waitForReadyRead(int msecs)

write

(1) Signature: long long write (string data, long long len)

Description: Method qint64 QIODevice::write(const char *data, qint64 len)

(2) Signature: long long write (bytes data)

Description: Method qint64 QIODevice::write(const QByteArray &data)