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. 更多...
| 頭: | #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 () |
| QDataStream & | operator<< (QDataStream & out , const QTypeRevision & revision ) |
| 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]
QTypeRevision::
QTypeRevision
()
Produces an invalid revision.
另請參閱 isValid ().
[static constexpr]
template <typename Integer, if_valid_value_type<Integer>>
QTypeRevision
QTypeRevision::
fromEncodedVersion
(
整數
value
)
Produces a 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, if_valid_segment_type<Major>>
QTypeRevision
QTypeRevision::
fromMajorVersion
(
Major
majorVersion
)
Produces a QTypeRevision 從給定 majorVersion with an invalid minor version. majorVersion needs to be a valid segment.
另請參閱 isValidSegment ().
[static constexpr]
template <typename Minor, if_valid_segment_type<Minor>>
QTypeRevision
QTypeRevision::
fromMinorVersion
(
Minor
minorVersion
)
Produces a QTypeRevision 從給定 minorVersion with an invalid major version. minorVersion needs to be a valid segment.
另請參閱 isValidSegment ().
[static constexpr]
template <typename Major, typename Minor, if_valid_segment_type<Major>, if_valid_segment_type
Produces a 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, if_valid_segment_type<Integer>>
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, if_valid_value_type<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.
整數
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
()
Produces a
QTypeRevision
with major and minor version
0
.
[since 6.0]
QDataStream
&
operator<<
(
QDataStream
&
out
, const
QTypeRevision
&
revision
)
Writes the revision revision 到流 out .
該函數在 Qt 6.0 引入。
[since 6.0]
QDataStream
&
operator>>
(
QDataStream
&
in
,
QTypeRevision
&
revision
)
Reads a revision from stream in and stores it in revision .
該函數在 Qt 6.0 引入。