QIODeviceBase¶
Base class for QIODevice
that provides flags describing the mode in which a device is opened. More…
Inherited by: QTextStream, QIODevice, QSerialPort, QNetworkReply, QLocalSocket, QAbstractSocket, QUdpSocket, QTcpSocket, QProcess, QFileDevice, QSaveFile, QFile, QTemporaryFile, QDataStream, QSslSocket, QBuffer, QBluetoothSocket
New in version 6.0.
Detailed Description¶
- class PySide6.QtCore.QIODeviceBase¶
PySide6.QtCore.QIODeviceBase(QIODeviceBase)
- Parameters
QIODeviceBase –
PySide6.QtCore.QIODeviceBase
- PySide6.QtCore.QIODeviceBase.OpenModeFlag¶
This enum is used with open()
to describe the mode in which a device is opened. It is also returned by openMode()
.
Constant
Description
QIODeviceBase.NotOpen
The device is not open.
QIODeviceBase.ReadOnly
The device is open for reading.
QIODeviceBase.WriteOnly
The device is open for writing. Note that, for file-system subclasses (e.g.
QFile
), this mode implies Truncate unless combined with , Append or .QIODeviceBase.ReadWrite
The device is open for reading and writing.
QIODeviceBase.Append
The device is opened in append mode so that all data is written to the end of the file.
QIODeviceBase.Truncate
If possible, the device is truncated before it is opened. All earlier contents of the device are lost.
QIODeviceBase.Text
When reading, the end-of-line terminators are translated to ‘\n’. When writing, the end-of-line terminators are translated to the local encoding, for example ‘\r\n’ for Win32.
QIODeviceBase.Unbuffered
Any buffer in the device is bypassed.
QIODeviceBase.NewOnly
Fail if the file to be opened already exists. Create and open the file only if it does not exist. There is a guarantee from the operating system that you are the only one creating and opening the file. Note that this mode implies , and combining it with is allowed. This flag currently only affects
QFile
. Other classes might use this flag in the future, but until then using this flag with any classes other thanQFile
may result in undefined behavior. (since Qt 5.11)QIODeviceBase.ExistingOnly
Fail if the file to be opened does not exist. This flag must be specified alongside , , or . Note that using this flag with alone is redundant, as already fails when the file does not exist. This flag currently only affects
QFile
. Other classes might use this flag in the future, but until then using this flag with any classes other thanQFile
may result in undefined behavior. (since Qt 5.11)
Certain flags, such as Unbuffered
and Truncate
, are meaningless when used with some subclasses. Some of these restrictions are implied by the type of device that is represented by a subclass. In other cases, the restriction may be due to the implementation, or may be imposed by the underlying platform; for example, QTcpSocket
does not support Unbuffered
mode, and limitations in the native API prevent QFile
from supporting Unbuffered
on Windows.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.