Skip to content

PythonQt.QtCore.QUuid

QUuid

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

Using Universally Unique IDentifiers (UUID) is a standard way to uniquely identify entities in a distributed computing environment. A UUID is a 16-byte (128-bit) number generated by some algorithm that is meant to guarantee that the UUID will be unique in the distributed computing environment where it is used. The acronym GUID is often used instead, Globally Unique IDentifiers, but it refers to the same thing.

Actually, the GUID is one variant of UUID. Multiple variants are in use. Each UUID contains a bit field that specifies which type (variant) of UUID it is. Call variant() to discover which type of UUID an instance of QUuid contains. It extracts the three most significant bits of byte 8 of the 16 bytes. In QUuid, byte 8 is QUuid::data4[0]. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the three most significant bits of parameter b1, which becomes QUuid::data4[0] and contains the variant field in its three most significant bits. In the table, 'x' means don't care.

msb0 msb1 msb2 Variant
0 x x NCS (Network Computing System)
1 0 x DCE (Distributed Computing Environment)
1 1 0 Microsoft (GUID)
1 1 1 Reserved for future expansion

If variant() returns QUuid::DCE, the UUID also contains a version field in the four most significant bits of QUuid::data3, and you can call version() to discover which version your QUuid contains. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the four most significant bits of parameter w2, which becomes QUuid::data3 and contains the version field in its four most significant bits.

msb0 msb1 msb2 msb3 Version
0 0 0 1 Time
0 0 1 0 Embedded POSIX
0 0 1 1 Md5(Name)
0 1 0 0 Random
0 1 0 1 Sha1

The field layouts for the DCE versions listed in the table above are specified in the Network Working Group UUID Specification.

Most platforms provide a tool for generating new UUIDs, e.g. uuidgen and guidgen. You can also use createUuid(). UUIDs generated by createUuid() are of the random type. Their QUuid::Version bits are set to QUuid::Random, and their QUuid::Variant bits are set to QUuid::DCE. The rest of the UUID is composed of random numbers. Theoretically, this means there is a small chance that a UUID generated by createUuid() will not be unique. But it is a very small chance.

UUIDs can be constructed from numeric values or from strings, or using the static createUuid() function. They can be converted to a string with toString(). UUIDs have a variant() and a version(), and null UUIDs return true from isNull().

Source: https://doc.qt.io/archives/qt-5.15/quuid.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
DCE attribute Any
EmbeddedPOSIX attribute Any
Md5 attribute Any (shared captured text)
Microsoft attribute Any
NCS attribute Any
Name attribute Any (shared captured text)
Random attribute Any
Reserved attribute Any
Sha1 attribute Any (shared captured text)
Time attribute Any (shared captured text)
VarUnknown attribute Any
Variant attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
VerUnknown attribute Any
Version attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
createUuid function (self) -> Any X.createUuid() -> PythonQt.QtCore.QUuid
createUuidV3 function (self, ns: Any, baseData: Any) -> Any X.createUuidV3(ns, baseData) -> PythonQt.QtCore.QUuid
createUuidV5 function (self, ns: Any, baseData: Any) -> Any X.createUuidV5(ns, baseData) -> PythonQt.QtCore.QUuid
data1 attribute Any
data2 attribute Any
data3 attribute Any
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
fromRfc4122 function (self, arg__1: Any) -> Any X.fromRfc4122(arg__1) -> PythonQt.QtCore.QUuid
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)
isNull function (self) -> bool X.isNull() -> bool
readFrom function (self, arg__1: Any) -> Any (shared captured text)
toByteArray function (self) -> Any X.toByteArray() -> PythonQt.QtCore.QByteArray
toRfc4122 function (self) -> Any X.toRfc4122() -> PythonQt.QtCore.QByteArray
toString function (self) -> str X.toString() -> str
variant function (self) -> Any Returns the value in the [variant field](https://doc.qt.io/archives/qt-5.15/quuid.html#variant-field) of the UUID.
version function (self) -> Any Returns the [version field](https://doc.qt.io/archives/qt-5.15/quuid.html#version-field) of the UUID, if the UUID's [variant field](https://doc.qt.io/archives/qt-5.15/quuid.html#variant-field) is…
writeTo function (self, arg__1: Any) -> Any (shared captured text)