QTypeRevision Class

The QTypeRevision class contains a lightweight representation of a version number with two 8-bit segments, major and minor, either of which can be unknown. More...

Header: #include <QTypeRevision>
CMake: find_package(Qt6 COMPONENTS Core REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Since: Qt 6.0

Public Functions

QTypeRevision()
bool hasMajorVersion() const
bool hasMinorVersion() const
bool isValid() const
quint8 majorVersion() const
quint8 minorVersion() const
Integer toEncodedVersion() const

Static Public Members

QTypeRevision fromEncodedVersion(Integer value)
QTypeRevision fromMajorVersion(Major majorVersion)
QTypeRevision fromMinorVersion(Minor minorVersion)
QTypeRevision fromVersion(Major majorVersion, Minor minorVersion)
bool isValidSegment(Integer segment)
QTypeRevision zero()
QDataStream & operator<<(QDataStream &out, const QTypeRevision &revision)
QDataStream & operator>>(QDataStream &in, QTypeRevision &revision)

Detailed Description

Use this class to describe revisions of a type. Compatible revisions can be expressed as increments of the minor version. Breaking changes can be expressed as increments of the major version. The return values of QMetaMethod::revision() and QMetaProperty::revision() can be passed to QTypeRevision::fromEncodedVersion(). The resulting major and minor versions specify in which Qt versions the properties and methods were added.

See also QMetaMethod::revision() and QMetaProperty::revision().

Member Function Documentation

QTypeRevision::QTypeRevision()

Produces an invalid revision.

See also isValid().

[static] template <typename Integer, if_valid_value_type<Integer>> QTypeRevision QTypeRevision::fromEncodedVersion(Integer value)

Produces a QTypeRevision from the given value. value encodes both the minor and major versions in the least significant and second least significant byte, respectively.

value must not have any bits outside the least significant two bytes set. Integer needs to be at least 16 bits wide, and must not have a sign bit in the least significant 16 bits.

See also toEncodedVersion().

[static] template <typename Major, if_valid_segment_type<Major>> QTypeRevision QTypeRevision::fromMajorVersion(Major majorVersion)

Produces a QTypeRevision from the given majorVersion with an invalid minor version. majorVersion needs to be a valid segment.

See also isValidSegment().

[static] template <typename Minor, if_valid_segment_type<Minor>> QTypeRevision QTypeRevision::fromMinorVersion(Minor minorVersion)

Produces a QTypeRevision from the given minorVersion with an invalid major version. minorVersion needs to be a valid segment.

See also isValidSegment().

[static] template <typename Major, typename Minor, if_valid_segment_type<Major>, if_valid_segment_type> QTypeRevision QTypeRevision::fromVersion(Major majorVersion, Minor minorVersion)

Produces a QTypeRevision from the given majorVersion and minorVersion, both of which need to be a valid segments.

See also isValidSegment().

bool QTypeRevision::hasMajorVersion() const

Returns true if the major version is known, otherwise false.

See also majorVersion() and hasMinorVersion().

bool QTypeRevision::hasMinorVersion() const

Returns true if the minor version is known, otherwise false.

See also minorVersion() and hasMajorVersion().

bool QTypeRevision::isValid() const

Returns true if the major version or the minor version is known, otherwise false.

See also hasMajorVersion() and hasMinorVersion().

[static] template <typename Integer, if_valid_segment_type<Integer>> bool QTypeRevision::isValidSegment(Integer segment)

Returns true if the given number can be used as either major or minor version in a QTypeRevision. The valid range for segment is >= 0 and < 255.

quint8 QTypeRevision::majorVersion() const

Returns the major version encoded in the revision.

See also hasMajorVersion() and minorVersion().

quint8 QTypeRevision::minorVersion() const

Returns the minor version encoded in the revision.

See also hasMinorVersion() and majorVersion().

template <typename Integer, if_valid_value_type<Integer>> Integer QTypeRevision::toEncodedVersion() const

Transforms the revision into an integer value, encoding the minor version into the least significant byte, and the major version into the second least significant byte.

Integer needs to be at least 16 bits wide, and must not have a sign bit in the least significant 16 bits.

See also fromEncodedVersion().

[static] QTypeRevision QTypeRevision::zero()

Produces a QTypeRevision with major and minor version 0.

Related Non-Members

[since 6.0] QDataStream &operator<<(QDataStream &out, const QTypeRevision &revision)

Writes the revision revision to stream out.

This function was introduced in Qt 6.0.

[since 6.0] QDataStream &operator>>(QDataStream &in, QTypeRevision &revision)

Reads a revision from stream in and stores it in revision.

This function was introduced in Qt 6.0.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.0/qtyperevision.html