Skip to content

PythonQt.QtCore.QSaveFile · declarations 001

Back to PythonQt.QtCore.QSaveFile

aboutToClose

aboutToClose(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QSaveFile.aboutToClose; argument details are not documented.

bytesWritten

bytesWritten(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QSaveFile.bytesWritten; argument details are not documented.

cancelWriting

cancelWriting() -> None

X.cancelWriting()

Supplemental documentation: Qt 5 reference:

void QSaveFile::cancelWriting()

Cancels writing the new file.

If the application changes its mind while saving, it can call cancelWriting(), which sets an error code so that commit() will discard the temporary file.

Alternatively, it can simply make sure not to call commit().

Further write operations are possible after calling this method, but none of it will have any effect, the written file will be discarded.

This method has no effect when direct write fallback is used. This is the case when saving over an existing file in a readonly directory: no temporary file can be created, so the existing file is overwritten no matter what, and cancelWriting() cannot do anything about that, the contents of the existing file will be lost.

See also commit().

Upstream PySide2 reference signatures (binding differences may apply):

cancelWriting(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsavefile.html#cancelWriting

channelBytesWritten

channelBytesWritten(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QSaveFile.channelBytesWritten; argument details are not documented.

channelReadyRead

channelReadyRead(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QSaveFile.channelReadyRead; argument details are not documented.

close

close() -> None

X.close()

Upstream PySide2 reference signatures (binding differences may apply):

close(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsavefile.html#close

commit

commit() -> bool

X.commit() -> bool

Supplemental documentation: Qt 5 reference:

bool QSaveFile::commit()

Commits the changes to disk, if all previous writes were successful.

It is mandatory to call this at the end of the saving operation, otherwise the file will be discarded.

If an error happened during writing, deletes the temporary file and returns false. Otherwise, renames it to the final fileName and returns true on success. Finally, closes the device.

See also cancelWriting().

Upstream PySide2 reference signatures (binding differences may apply):

commit(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qsavefile.html#commit

destroyed

destroyed(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QSaveFile.destroyed; argument details are not documented.

directWriteFallback

directWriteFallback() -> bool

X.directWriteFallback() -> bool

Supplemental documentation: Qt 5 reference:

bool QSaveFile::directWriteFallback() const

Returns true if the fallback solution for saving files in read-only directories is enabled.

See also setDirectWriteFallback().

Upstream PySide2 reference signatures (binding differences may apply):

directWriteFallback(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qsavefile.html#directWriteFallback

fileName

fileName() -> str

X.fileName() -> str

Supplemental documentation: Qt 5 reference:

[override virtual] QString QSaveFile::fileName() const

Reimplements: QFileDevice::fileName() const.

Returns the name set by setFileName() or to the QSaveFile constructor.

See also setFileName().

Upstream PySide2 reference signatures (binding differences may apply):

fileName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qsavefile.html#fileName

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QSaveFile.objectNameChanged; argument details are not documented.

open

open(arg0: flags) -> bool

X.open(flags) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual] bool QSaveFile::open(QIODevice::OpenMode mode)

Reimplements: QIODevice::open(QIODevice::OpenMode mode).

Opens the file using OpenMode mode, returning true if successful; otherwise false.

Important: the mode must include QIODevice::WriteOnly. It may also have additional flags, such as QIODevice::Text and QIODevice::Unbuffered.

QIODevice::ReadWrite, QIODevice::Append, QIODevice::NewOnly and QIODevice::ExistingOnly are not supported at the moment.

See also QIODevice::OpenMode and setFileName().

Upstream PySide2 reference signatures (binding differences may apply):

open(self, flags: PySide2.QtCore.QIODevice.OpenMode) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qsavefile.html#open

permissions

permissions() -> Any

X.permissions()

readChannelFinished

readChannelFinished(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QSaveFile.readChannelFinished; argument details are not documented.

readyRead

readyRead(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtCore.QSaveFile.readyRead; argument details are not documented.

resize

resize(sz: Any) -> bool

X.resize(sz) -> bool

setDirectWriteFallback

setDirectWriteFallback(enabled: bool) -> None

X.setDirectWriteFallback(enabled)

Supplemental documentation: Qt 5 reference:

void QSaveFile::setDirectWriteFallback(bool enabled)

Allows writing over the existing file if necessary.

QSaveFile creates a temporary file in the same directory as the final file and atomically renames it. However this is not possible if the directory permissions do not allow creating new files. In order to preserve atomicity guarantees, open() fails when it cannot create the temporary file.

In order to allow users to edit files with write permissions in a directory with restricted permissions, call setDirectWriteFallback() with enabled set to true, and the following calls to open() will fallback to opening the existing file directly and writing into it, without the use of a temporary file. This does not have atomicity guarantees, i.e. an application crash or for instance a power failure could lead to a partially-written file on disk. It also means cancelWriting() has no effect, in such a case.

Typically, to save documents edited by the user, call setDirectWriteFallback(true), and to save application internal files (configuration files, data files, ...), keep the default setting which ensures atomicity.

See also directWriteFallback().

Upstream PySide2 reference signatures (binding differences may apply):

setDirectWriteFallback(self, enabled: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsavefile.html#setDirectWriteFallback

setFileName

setFileName(name: str) -> None

X.setFileName(name)

Supplemental documentation: Qt 5 reference:

void QSaveFile::setFileName(const QString \&name)

Sets the name of the file. The name can have no path, a relative path, or an absolute path.

See also QFile::setFileName() and fileName().

Upstream PySide2 reference signatures (binding differences may apply):

setFileName(self, name: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsavefile.html#setFileName

setPermissions

setPermissions(permissionSpec: Any) -> bool

X.setPermissions(permissionSpec) -> bool

writeData

writeData(data: str, len: int) -> int

X.writeData(data, len) -> int

Supplemental documentation: Qt 5 reference:

[override virtual protected] qint64 QSaveFile::writeData(const char *data, qint64 len)

Reimplements: QFileDevice::writeData(const char *data, qint64 len).

Upstream PySide2 reference signatures (binding differences may apply):

writeData(self, data: str, len: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qsavefile.html#writeData