QTypeRevision 类包含版本号的轻量表示,带有两个 8 位段、主要及次要 (其中任一可能未知)。 更多...
头: | #include <QTypeRevision> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
Since: | Qt 6.0 |
QTypeRevision () | |
bool | hasMajorVersion () const |
bool | hasMinorVersion () const |
bool | isValid () const |
quint8 | majorVersion () const |
quint8 | minorVersion () const |
整数 | toEncodedVersion () const |
QTypeRevision | fromEncodedVersion (Integer value ) |
QTypeRevision | fromMajorVersion (Major majorVersion ) |
QTypeRevision | fromMinorVersion (Minor minorVersion ) |
QTypeRevision | fromVersion (Major majorVersion , Minor minorVersion ) |
bool | isValidSegment (Integer segment ) |
QTypeRevision | zero () |
(从 6.0 起)
QDataStream &
|
operator<< (QDataStream & out , const QTypeRevision & revision ) |
(从 6.0 起)
QDataStream &
|
operator>> (QDataStream & in , QTypeRevision & revision ) |
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 () 和 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.
另请参阅 QMetaMethod::revision () 和 QMetaProperty::revision ().
[constexpr noexcept]
QTypeRevision::
QTypeRevision
()
Produces an invalid revision.
另请参阅 isValid ().
[static constexpr]
template <typename Integer, QTypeRevision::if_valid_value_type<Integer> = true>
QTypeRevision
QTypeRevision::
fromEncodedVersion
(
整数
value
)
产生 QTypeRevision 从给定 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.
整数
needs to be at least 16 bits wide, and must not have a sign bit in the least significant 16 bits.
另请参阅 toEncodedVersion ().
[static constexpr]
template <typename Major, QTypeRevision::if_valid_segment_type<Major> = true>
QTypeRevision
QTypeRevision::
fromMajorVersion
(
Major
majorVersion
)
产生 QTypeRevision 从给定 majorVersion with an invalid minor version. majorVersion needs to be a valid segment.
另请参阅 isValidSegment ().
[static constexpr]
template <typename Minor, QTypeRevision::if_valid_segment_type<Minor> = true>
QTypeRevision
QTypeRevision::
fromMinorVersion
(
Minor
minorVersion
)
产生 QTypeRevision 从给定 minorVersion with an invalid major version. minorVersion needs to be a valid segment.
另请参阅 isValidSegment ().
[static constexpr]
template <typename Major, typename Minor, QTypeRevision::if_valid_segment_type<Major> = true, QTypeRevision::if_valid_segment_type
产生 QTypeRevision 从给定 majorVersion and minorVersion , both of which need to be a valid segments.
另请参阅 isValidSegment ().
[constexpr]
bool
QTypeRevision::
hasMajorVersion
() const
Returns true if the major version is known, otherwise false.
另请参阅 majorVersion () 和 hasMinorVersion ().
[constexpr]
bool
QTypeRevision::
hasMinorVersion
() const
Returns true if the minor version is known, otherwise false.
另请参阅 minorVersion () 和 hasMajorVersion ().
[constexpr]
bool
QTypeRevision::
isValid
() const
Returns true if the major version or the minor version is known, otherwise false.
另请参阅 hasMajorVersion () 和 hasMinorVersion ().
[static constexpr]
template <typename Integer, QTypeRevision::if_valid_segment_type<Integer> = true>
bool
QTypeRevision::
isValidSegment
(
整数
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
.
[constexpr]
quint8
QTypeRevision::
majorVersion
() const
Returns the major version encoded in the revision.
另请参阅 hasMajorVersion () 和 minorVersion ().
[constexpr]
quint8
QTypeRevision::
minorVersion
() const
Returns the minor version encoded in the revision.
另请参阅 hasMinorVersion () 和 majorVersion ().
[constexpr]
template <typename Integer, QTypeRevision::if_valid_value_type<Integer> = true>
整数
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.
整数
needs to be at least 16 bits wide, and must not have a sign bit in the least significant 16 bits.
另请参阅 fromEncodedVersion ().
[static constexpr]
QTypeRevision
QTypeRevision::
zero
()
产生
QTypeRevision
采用主要和次要版本
0
.
[since 6.0]
QDataStream
&
operator<<
(
QDataStream
&
out
, const
QTypeRevision
&
revision
)
写入修订 revision 到流 out .
该函数在 Qt 6.0 引入。
[since 6.0]
QDataStream
&
operator>>
(
QDataStream
&
in
,
QTypeRevision
&
revision
)
读取修订从流 in and stores it in revision .
该函数在 Qt 6.0 引入。