QVersionNumber¶
The
QVersionNumberclass contains a version number with an arbitrary number of segments. More…

New in version 5.6.
Synopsis¶
Functions¶
def
__eq__(, rhs)def
__ge__(, rhs)def
__gt__(, rhs)def
__le__(, rhs)def
__lt__(, rhs)def
__ne__(, rhs)def
isNormalized()def
isNull()def
isPrefixOf(other)def
majorVersion()def
microVersion()def
minorVersion()def
normalized()def
segmentAt(index)def
segmentCount()def
segments()def
toString()
Static functions¶
def
commonPrefix(v1, v2)def
compare(v1, v2)def
fromString(string)
Detailed Description¶
QVersionNumber version(1, 2, 3); // 1.2.3
- class PySide2.QtCore.QVersionNumber¶
PySide2.QtCore.QVersionNumber(seg)
PySide2.QtCore.QVersionNumber(seg)
PySide2.QtCore.QVersionNumber(maj)
PySide2.QtCore.QVersionNumber(maj, min)
PySide2.QtCore.QVersionNumber(maj, min, mic)
- param mic:
int
- param seg:
- param min:
int
- param maj:
int
Produces a null version.
See also
Constructs a
QVersionNumberconsisting of just the major version numbermaj.Constructs a
QVersionNumberconsisting of the major and minor version numbersmajandmin, respectively.Constructs a
QVersionNumberconsisting of the major, minor, and micro version numbersmaj,minandmic, respectively.
- PySide2.QtCore.QVersionNumber.enum_271¶
- static PySide2.QtCore.QVersionNumber.commonPrefix(v1, v2)¶
- Parameters:
- Return type:
QVersionNumber(constQVersionNumber&v1, constQVersionNumber&v2)Returns a version number that is a parent version of both
v1andv2.See also
- static PySide2.QtCore.QVersionNumber.compare(v1, v2)¶
- Parameters:
- Return type:
int
Compares
v1withv2and returns an integer less than, equal to, or greater than zero, depending on whetherv1is less than, equal to, or greater thanv2, respectively.Comparisons are performed by comparing the segments of
v1andv2starting at index 0 and working towards the end of the longer list.QVersionNumber v1(1, 2); QVersionNumber v2(1, 2, 0); int compare = QVersionNumber::compare(v1, v2); // compare == -1
- static PySide2.QtCore.QVersionNumber.fromString(string)¶
- Parameters:
string – str
- Return type:
- PySide2.QtCore.QVersionNumber.isNormalized()¶
- Return type:
bool
Returns
trueif the version number does not contain any trailing zeros, otherwise returnsfalse.See also
- PySide2.QtCore.QVersionNumber.isNull()¶
- Return type:
bool
Returns
trueif there are zero numerical segments, otherwise returnsfalse.See also
- PySide2.QtCore.QVersionNumber.isPrefixOf(other)¶
- Parameters:
other –
PySide2.QtCore.QVersionNumber- Return type:
bool
Returns
trueif the current version number is contained in theotherversion number, otherwise returnsfalse.QVersionNumber v1(5, 3); QVersionNumber v2(5, 3, 1); bool value = v1.isPrefixOf(v2); // true
See also
- PySide2.QtCore.QVersionNumber.majorVersion()¶
- Return type:
int
Returns the major version number, that is, the first segment. This function is equivalent to
segmentAt(0). If thisQVersionNumberobject is null, this function returns 0.See also
- PySide2.QtCore.QVersionNumber.microVersion()¶
- Return type:
int
Returns the micro version number, that is, the third segment. This function is equivalent to
segmentAt(2). If thisQVersionNumberobject does not contain a micro number, this function returns 0.See also
- PySide2.QtCore.QVersionNumber.minorVersion()¶
- Return type:
int
Returns the minor version number, that is, the second segment. This function is equivalent to
segmentAt(1). If thisQVersionNumberobject does not contain a minor number, this function returns 0.See also
- PySide2.QtCore.QVersionNumber.normalized()¶
- Return type:
Returns an equivalent version number but with all trailing zeros removed.
To check if two numbers are equivalent, use on both version numbers before performing the compare.
QVersionNumber v1(5, 4); QVersionNumber v2(5, 4, 0); bool equivalent = v1.normalized() == v2.normalized(); bool equal = v1 == v2; // equivalent is true // equal is false
- PySide2.QtCore.QVersionNumber.__ne__(rhs)¶
- Parameters:
- Return type:
bool
- PySide2.QtCore.QVersionNumber.__lt__(rhs)¶
- Parameters:
- Return type:
bool
- PySide2.QtCore.QVersionNumber.__le__(rhs)¶
- Parameters:
- Return type:
bool
- PySide2.QtCore.QVersionNumber.__eq__(rhs)¶
- Parameters:
- Return type:
bool
- PySide2.QtCore.QVersionNumber.__gt__(rhs)¶
- Parameters:
- Return type:
bool
- PySide2.QtCore.QVersionNumber.__ge__(rhs)¶
- Parameters:
- Return type:
bool
- PySide2.QtCore.QVersionNumber.segmentAt(index)¶
- Parameters:
index – int
- Return type:
int
Returns the segment value at
index. If the index does not exist, returns 0.See also
- PySide2.QtCore.QVersionNumber.segmentCount()¶
- Return type:
int
Returns the number of integers stored in
segments().See also
- PySide2.QtCore.QVersionNumber.segments()¶
- Return type:
Returns all of the numerical segments.
See also
- PySide2.QtCore.QVersionNumber.toString()¶
- Return type:
str
Returns a string with all of the segments delimited by a period (
.).
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.