Skip to content

PythonQt.QtCore.QTemporaryFile · declarations 001

Back to PythonQt.QtCore.QTemporaryFile

aboutToClose

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

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

autoRemove

autoRemove() -> bool

X.autoRemove() -> bool

Supplemental documentation: Qt 5 reference:

bool QTemporaryFile::autoRemove() const

Returns true if the QTemporaryFile is in auto remove mode. Auto-remove mode will automatically delete the filename from disk upon destruction. This makes it very easy to create your QTemporaryFile object on the stack, fill it with data, read from it, and finally on function return it will automatically clean up after itself.

Auto-remove is on by default.

See also setAutoRemove() and remove().

Upstream PySide2 reference signatures (binding differences may apply):

autoRemove(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qtemporaryfile.html#autoRemove

bytesWritten

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

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

channelBytesWritten

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

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

channelReadyRead

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

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

copy

copy(fileName: Any, newName: Any) -> bool

X.copy(fileName, newName) -> bool

createLocalFile

createLocalFile(file: Any) -> Any

X.createLocalFile(file) -> PythonQt.QtCore.QTemporaryFile

Upstream PySide2 reference signatures (binding differences may apply):

createLocalFile(file: PySide2.QtCore.QFile) -> PySide2.QtCore.QTemporaryFile
createLocalFile(fileName: str) -> PySide2.QtCore.QTemporaryFile

Source: https://doc.qt.io/archives/qt-5.15/qtemporaryfile.html#createLocalFile

createNativeFile

createNativeFile(file: Any) -> Any

X.createNativeFile(file) -> PythonQt.QtCore.QTemporaryFile

Supplemental documentation: Qt 5 reference:

[static] QTemporaryFile *QTemporaryFile::createNativeFile(QFile \&file)

If file is not already a native file, then a QTemporaryFile is created in QDir::tempPath(), the contents of file is copied into it, and a pointer to the temporary file is returned. Does nothing and returns 0 if file is already a native file.

For example:

  QFile f(":/resources/file.txt");
  QTemporaryFile::createNativeFile(f); // Returns a pointer to a temporary file

  QFile f("/users/qt/file.txt");
  QTemporaryFile::createNativeFile(f); // Returns 0

See also QFileInfo::isNativePath().

[static] QTemporaryFile *QTemporaryFile::createNativeFile(const QString \&fileName)

This is an overloaded function.

Works on the given fileName rather than an existing QFile object.

Upstream PySide2 reference signatures (binding differences may apply):

createNativeFile(file: PySide2.QtCore.QFile) -> PySide2.QtCore.QTemporaryFile
createNativeFile(fileName: str) -> PySide2.QtCore.QTemporaryFile

Source: https://doc.qt.io/archives/qt-5.15/qtemporaryfile.html#createNativeFile

decodeName

decodeName(localFileName: Any) -> str

X.decodeName(localFileName) -> str

destroyed

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

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

encodeName

encodeName(fileName: Any) -> Any

X.encodeName(fileName) -> PythonQt.QtCore.QByteArray

exists

exists() -> bool

X.exists() -> bool

fileName

fileName() -> str

X.fileName() -> str

Supplemental documentation: Qt 5 reference:

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

Reimplements: QFileDevice::fileName() const.

Returns the complete unique filename backing the QTemporaryFile object. This string is null before the QTemporaryFile is opened, afterwards it will contain the fileTemplate() plus additional characters to make it unique.

See also fileTemplate().

Upstream PySide2 reference signatures (binding differences may apply):

fileName(self) -> str

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

fileTemplate

fileTemplate() -> str

X.fileTemplate() -> str

Supplemental documentation: Qt 5 reference:

QString QTemporaryFile::fileTemplate() const

Returns the set file template. The default file template will be called qcoreappname.XXXXXX and be placed in QDir::tempPath().

See also setFileTemplate().

Upstream PySide2 reference signatures (binding differences may apply):

fileTemplate(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qtemporaryfile.html#fileTemplate

link(newName: Any) -> bool

X.link(newName) -> bool

objectNameChanged

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

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

open

open(arg0: flags) -> bool

X.open(flags) -> bool

Supplemental documentation: Qt 5 reference:

bool QTemporaryFile::open()

A QTemporaryFile will always be opened in QIODevice::ReadWrite mode, this allows easy access to the data in the file. This function will return true upon success and will set the fileName() to the unique filename used.

See also fileName().

[override virtual protected] bool QTemporaryFile::open(QIODevice::OpenMode flags)

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

Creates a unique file name for the temporary file, and opens it. You can get the unique name later by calling fileName(). The file is guaranteed to have been created by this function (i.e., it has never existed before).

Upstream PySide2 reference signatures (binding differences may apply):

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

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

readChannelFinished

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

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

readyRead

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

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

remove

remove() -> bool

X.remove() -> bool

rename

rename(newName: str) -> bool

X.rename(newName) -> bool

Supplemental documentation: Qt 5 reference:

bool QTemporaryFile::rename(const QString \&newName)

Renames the current temporary file to newName and returns true if it succeeded.

This function has an important difference compared to QFile::rename(): it will not perform a copy+delete if the low-level system call to rename the file fails, something that could happen if newName specifies a file in a different volume or filesystem than the temporary file was created on. In other words, QTemporaryFile only supports atomic file renaming.

This functionality is intended to support materializing the destination file with all contents already present, so another process cannot see an incomplete file in the process of being written. The QSaveFile class can be used for a similar purpose too, particularly if the destination file is not temporary.

See also QSaveFile, QSaveFile::commit(), and QFile::rename().

Upstream PySide2 reference signatures (binding differences may apply):

rename(self, newName: str) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qtemporaryfile.html#rename

setAutoRemove

setAutoRemove(b: bool) -> None

X.setAutoRemove(b)

Supplemental documentation: Qt 5 reference:

void QTemporaryFile::setAutoRemove(bool b)

Sets the QTemporaryFile into auto-remove mode if b is true.

Auto-remove is on by default.

If you set this property to false, ensure the application provides a way to remove the file once it is no longer needed, including passing the responsibility on to another process. Always use the fileName() function to obtain the name and never try to guess the name that QTemporaryFile has generated.

On some systems, if fileName() is not called before closing the file, the temporary file may be removed regardless of the state of this property. This behavior should not be relied upon, so application code should either call fileName() or leave the auto removal functionality enabled.

See also autoRemove() and remove().

Upstream PySide2 reference signatures (binding differences may apply):

setAutoRemove(self, b: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qtemporaryfile.html#setAutoRemove

setFileName

setFileName(name: Any) -> Any

X.setFileName(name)

setFileTemplate

setFileTemplate(name: str) -> None

X.setFileTemplate(name)

Supplemental documentation: Qt 5 reference:

void QTemporaryFile::setFileTemplate(const QString \&name)

Sets the static portion of the file name to name. If the file template contains XXXXXX that will automatically be replaced with the unique part of the filename, otherwise a filename will be determined automatically based on the static portion specified.

If name contains a relative file path, the path will be relative to the current working directory. You can use QDir::tempPath() to construct name if you want use the system's temporary directory. It is important to specify the correct directory if the rename() function will be called, as QTemporaryFile can only rename files within the same volume / filesystem as the temporary file itself was created on.

See also fileTemplate().

Upstream PySide2 reference signatures (binding differences may apply):

setFileTemplate(self, name: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qtemporaryfile.html#setFileTemplate

symLinkTarget

symLinkTarget() -> str

X.symLinkTarget() -> str