PythonQt.QtCore.QBuffer
QBuffer
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
QBuffer allows you to access a QByteArray using the QIODevice interface. The QByteArray is treated just as a standard random-accessed file. Example:
QBuffer buffer;
char ch;
buffer.open(QBuffer::ReadWrite);
buffer.write("Qt rocks!");
buffer.seek(0);
buffer.getChar(&ch); // ch == 'Q'
buffer.getChar(&ch); // ch == 't'
buffer.getChar(&ch); // ch == ' '
buffer.getChar(&ch); // ch == 'r'
By default, an internal QByteArray buffer is created for you when you create a QBuffer. You can access this buffer directly by calling buffer(). You can also use QBuffer with an existing QByteArray by calling setBuffer(), or by passing your array to QBuffer's constructor.
Call open() to open the buffer. Then call write() or putChar() to write to the buffer, and read(), readLine(), readAll(), or getChar() to read from it. size() returns the current size of the buffer, and you can seek to arbitrary positions in the buffer by calling seek(). When you are done with accessing the buffer, call close().
The following code snippet shows how to write data to a QByteArray using QDataStream and QBuffer:
QByteArray byteArray;
QBuffer buffer(&byteArray);
buffer.open(QIODevice::WriteOnly);
QDataStream out(&buffer);
out << QApplication::palette();
Effectively, we convert the application's QPalette into a byte array. Here's how to read the data from the QByteArray:
QPalette palette;
QBuffer buffer(&byteArray);
buffer.open(QIODevice::ReadOnly);
QDataStream in(&buffer);
in >> palette;
QTextStream and QDataStream also provide convenience constructors that take a QByteArray and that create a QBuffer behind the scenes.
QBuffer emits readyRead() when new data has arrived in the buffer. By connecting to this signal, you can use QBuffer to store temporary data before processing it. QBuffer also emits bytesWritten() every time new data has been written to the buffer.
Source: https://doc.qt.io/archives/qt-5.15/qbuffer.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
Append |
attribute | Any |
|
NotOpen |
attribute | Any |
|
OpenMode |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
OpenModeFlag |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
ReadOnly |
attribute | Any |
|
ReadWrite |
attribute | Any |
|
Text |
attribute | Any |
|
Truncate |
attribute | Any |
|
Unbuffered |
attribute | Any |
|
WriteOnly |
attribute | Any |
|
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
aboutToClose |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QBuffer.aboutToClose; argument details are not documented. |
atEnd |
function | (self) -> bool |
X.atEnd() -> bool |
blockSignals |
function | (self, b: Any) -> bool |
X.blockSignals(b) -> bool (shared captured text) |
buffer |
function | (self) -> Any |
X.buffer() -> PythonQt.QtCore.QByteArray |
bytesAvailable |
function | (self) -> int |
X.bytesAvailable() -> int |
bytesToWrite |
function | (self) -> int |
X.bytesToWrite() -> int |
bytesWritten |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QBuffer.bytesWritten; argument details are not documented. |
canReadLine |
function | (self) -> bool |
X.canReadLine() -> bool |
channelBytesWritten |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QBuffer.channelBytesWritten; argument details are not documented. |
channelReadyRead |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QBuffer.channelReadyRead; argument details are not documented. |
childEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
children |
function | (self) -> tuple |
X.children() -> tuple (shared captured text) |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
close |
function | (self) -> None |
Reimplements: [QIODevice::close](https://doc.qt.io/archives/qt-5.15/qiodevice.html#close)(). |
connect |
function | (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool |
X.connect(signal, receiver, slot, type) -> bool (shared captured text) |
connectNotify |
function | (self, arg__1: Any) -> None |
|
customEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
data |
function | (self) -> Any |
X.data() -> PythonQt.QtCore.QByteArray |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
deleteLater |
function | (self) -> Any |
(shared captured text) |
destroyed |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QBuffer.destroyed; argument details are not documented. |
disconnect |
function | (self, signal: Any, receiver: Any, slot: Any) -> bool |
X.disconnect(signal, receiver, slot) -> bool (shared captured text) |
disconnectNotify |
function | (self, arg__1: Any) -> None |
|
dumpObjectInfo |
function | (self) -> Any |
(shared captured text) |
dumpObjectTree |
function | (self) -> Any |
(shared captured text) |
dynamicPropertyNames |
function | (self) -> Any |
(shared captured text) |
errorString |
function | (self) -> str |
X.errorString() -> str |
event |
function | (self, event: Any) -> bool |
X.event(event) -> bool (shared captured text) |
eventFilter |
function | (self, watched: Any, event: Any) -> bool |
X.eventFilter(watched, event) -> bool (shared captured text) |
findChild |
function | (self, type: Any, name: Any) -> Any |
X.findChild(type, name) -> PythonQt.private.QObject (shared captured text) |
findChildren |
function | (self, type: Any, name: Any) -> tuple |
X.findChildren(type, name) -> tuple (shared captured text) |
getChar |
function | (self, c: Any) -> bool |
X.getChar(c) -> bool |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
installEventFilter |
function | (self, filterObj: Any) -> Any |
(shared captured text) |
isOpen |
function | (self) -> bool |
X.isOpen() -> bool |
isReadable |
function | (self) -> bool |
X.isReadable() -> bool |
isSequential |
function | (self) -> bool |
X.isSequential() -> bool |
isSignalConnected |
function | (self, signal: Any) -> bool |
X.isSignalConnected(signal) -> bool (shared captured text) |
isTextModeEnabled |
function | (self) -> bool |
X.isTextModeEnabled() -> bool |
isWidgetType |
function | (self) -> bool |
X.isWidgetType() -> bool (shared captured text) |
isWindowType |
function | (self) -> bool |
X.isWindowType() -> bool (shared captured text) |
isWritable |
function | (self) -> bool |
X.isWritable() -> bool |
killTimer |
function | (self, id: Any) -> Any |
(shared captured text) |
metaObject |
function | (self) -> Any |
X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text) |
moveToThread |
function | (self, thread: Any) -> Any |
(shared captured text) |
objectName |
attribute | Any |
(shared captured text) |
objectNameChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QBuffer.objectNameChanged; argument details are not documented. |
open |
function | (self, openMode: Any) -> bool |
X.open(openMode) -> bool |
openMode |
function | (self) -> Any |
|
parent |
function | (self) -> Any |
X.parent() -> PythonQt.private.QObject (shared captured text) |
peek |
function | (self, maxlen: Any) -> Any |
X.peek(maxlen) -> PythonQt.QtCore.QByteArray |
pos |
function | (self) -> int |
X.pos() -> int |
property |
function | (self, name: Any) -> Any |
X.property(name) -> object (shared captured text) |
putChar |
function | (self, c: Any) -> bool |
X.putChar(c) -> bool |
read |
function | (self, maxlen: Any) -> Any |
X.read(maxlen) -> PythonQt.QtCore.QByteArray |
readAll |
function | (self) -> Any |
X.readAll() -> PythonQt.QtCore.QByteArray |
readChannelFinished |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QBuffer.readChannelFinished; argument details are not documented. |
readData |
function | (self, data: str, maxlen: int) -> int |
X.readData(data, maxlen) -> int |
readLine |
function | (self, maxlen: Any) -> Any |
X.readLine(maxlen) -> PythonQt.QtCore.QByteArray |
readLineData |
function | (self, data: Any, maxlen: Any) -> int |
X.readLineData(data, maxlen) -> int |
readyRead |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QBuffer.readyRead; argument details are not documented. |
removeEventFilter |
function | (self, obj: Any) -> Any |
(shared captured text) |
reset |
function | (self) -> bool |
X.reset() -> bool |
seek |
function | (self, off: int) -> bool |
X.seek(off) -> bool |
sender |
function | (self) -> Any |
X.sender() -> PythonQt.private.QObject (shared captured text) |
senderSignalIndex |
function | (self) -> int |
X.senderSignalIndex() -> int (shared captured text) |
setBuffer |
function | (self, a: Any) -> None |
Makes [QBuffer](https://doc.qt.io/archives/qt-5.15/qbuffer.html) use the [QByteArray](https://doc.qt.io/archives/qt-5.15/qbytearray.html) pointed to by byteArray as its internal buffer. |
setData |
function | (self, data: Any) -> None |
Sets the contents of the internal buffer to be data. |
setErrorString |
function | (self, errorString: Any) -> Any |
|
setObjectName |
function | (self, name: Any) -> Any |
(shared captured text) |
setOpenMode |
function | (self, openMode: Any) -> Any |
|
setParent |
function | (self, parent: Any) -> Any |
(shared captured text) |
setProperty |
function | (self, name: Any, value: Any) -> bool |
X.setProperty(name, value) -> bool (shared captured text) |
setTextModeEnabled |
function | (self, enabled: Any) -> Any |
|
signalsBlocked |
function | (self) -> bool |
X.signalsBlocked() -> bool (shared captured text) |
size |
function | (self) -> int |
X.size() -> int |
startTimer |
function | (self, interval: Any, timerType: Any) -> int |
X.startTimer(interval, timerType) -> int (shared captured text) |
thread |
function | (self) -> Any |
(shared captured text) |
timerEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
tr |
function | (self, text: Any, ambig: Any, n: Any) -> str |
X.tr(text, ambig, n) -> str (shared captured text) |
ungetChar |
function | (self, c: Any) -> Any |
|
waitForBytesWritten |
function | (self, msecs: Any) -> bool |
X.waitForBytesWritten(msecs) -> bool |
waitForReadyRead |
function | (self, msecs: Any) -> bool |
X.waitForReadyRead(msecs) -> bool |
write |
function | (self, data: Any) -> int |
X.write(data) -> int |
writeData |
function | (self, data: str, len: int) -> int |
X.writeData(data, len) -> int |