Contains a version number with an arbitrary number of segments.
More...
|
static QVersionNumber | commonPrefix (const QVersionNumber &v1, const QVersionNumber &v2) |
|
static int | compare (const QVersionNumber &v1, const QVersionNumber &v2) |
|
static QVersionNumber | fromString (const QString &string, int *suffixIndex=nullptr) |
|
The QVersionNumber class contains a version number with an arbitrary number of segments.
QVersionNumber::QVersionNumber |
( |
| ) |
|
|
inline |
Constructs an empty QVersionNumber.
- See also
- isNull()
QVersionNumber::QVersionNumber |
( |
const QVector< int > & |
seg | ) |
|
|
inlineexplicit |
Constructs a version number from the list of numbers contained in seg.
QVersionNumber::QVersionNumber |
( |
QVector< int > && |
seg | ) |
|
|
inlineexplicit |
Move constructs a version number from the list of numbers contained in seg.
QVersionNumber::QVersionNumber |
( |
std::initializer_list< int > |
args | ) |
|
|
inline |
Construct a version number from the std::initializer_list specified by args.
QVersionNumber::QVersionNumber |
( |
int |
maj | ) |
|
|
inlineexplicit |
Constructs a QVersionNumber consisting of just the major version number maj.
QVersionNumber::QVersionNumber |
( |
int |
maj, |
|
|
int |
min |
|
) |
| |
|
inlineexplicit |
Constructs a QVersionNumber consisting of the major and minor version numbers maj and min, respectively.
QVersionNumber::QVersionNumber |
( |
int |
maj, |
|
|
int |
min, |
|
|
int |
mic |
|
) |
| |
|
inlineexplicit |
Constructs a QVersionNumber consisting of the major, minor, and micro version numbers maj, min and mic, respectively.
QVersionNumber QVersionNumber::commonPrefix |
( |
const QVersionNumber & |
v1, |
|
|
const QVersionNumber & |
v2 |
|
) |
| |
|
static |
Returns a version number which is a parent version of both v1 and v2.
- See also
- isPrefixOf()
int QVersionNumber::compare |
( |
const QVersionNumber & |
v1, |
|
|
const QVersionNumber & |
v2 |
|
) |
| |
|
static |
Compares v1 with v2 and returns an integer less than, equal to, or greater than zero, depending on whether v1 is less than, equal to, or greater than v2, respectively.
Comparisons are performed by comparing the segments of v1 and v2 starting at index 0 and working towards the end of the longer list.
QVersionNumber QVersionNumber::fromString |
( |
const QString & |
string, |
|
|
int * |
suffixIndex = nullptr |
|
) |
| |
|
static |
Constructs a QVersionNumber from a specially formatted string of non-negative decimal numbers delimited by '.'.
Once the numerical segments have been parsed, the remainder of the string is considered to be the suffix string. The start index of the string will be stored in suffixIndex if it is not a nullptr.
- See also
- isNull()
bool QVersionNumber::isNormalized |
( |
| ) |
const |
|
inline |
Returns true if the version number does not contain any trailing zeros, otherwise returns false.
- See also
- normalized()
bool QVersionNumber::isNull |
( |
| ) |
const |
|
inline |
Returns true if there are zero numerical segments, otherwise returns false.
- See also
- segments()
bool QVersionNumber::isPrefixOf |
( |
const QVersionNumber & |
other | ) |
const |
Returns true if the current version number is contained in the other version number, otherwise returns false. If this QVersionNumber is empty it will be a prefix of any QVersionNumber.
bool value = v1.isPrefixOf(v2);
- See also
- commonPrefix()
int QVersionNumber::majorVersion |
( |
| ) |
const |
|
inline |
Returns the major version number which is the first segment. This method is equivalent to segmentAt(0). If this QVersionNumber is empty, returns 0.
- See also
- isNull(), segmentAt()
int QVersionNumber::microVersion |
( |
| ) |
const |
|
inline |
Returns the micro version number which is he third segment. This method is equivalent to segmentAt(2). If this QVersionNumber does not contain a micro number, returns 0.
- See also
- isNull(), segmentAt()
int QVersionNumber::minorVersion |
( |
| ) |
const |
|
inline |
Returns the minor version number which is the second segment. This method is equivalent to segmentAt(1). If this QVersionNumber does not contain a minor number, returns 0.
- See also
- isNull(), segmentAt()
QVersionNumber QVersionNumber::normalized |
( |
| ) |
const |
Returns an equivalent version number but with all trailing zeros removed. To check if two numbers are equivalent, use normalized() on both version numbers before performing the compare.
bool equivalent = v1.normalized() == v2.normalized();
bool equal = v1 == v2;
bool QVersionNumber::operator!= |
( |
const QVersionNumber & |
other | ) |
const |
bool QVersionNumber::operator< |
( |
const QVersionNumber & |
other | ) |
const |
bool QVersionNumber::operator<= |
( |
const QVersionNumber & |
other | ) |
const |
Returns true if this QVersionNumber is less than or equal to other, otherwise returns false.
- See also
- QVersionNumber::compare()
bool QVersionNumber::operator== |
( |
const QVersionNumber & |
other | ) |
const |
|
inlinenoexcept |
bool QVersionNumber::operator> |
( |
const QVersionNumber & |
other | ) |
const |
bool QVersionNumber::operator>= |
( |
const QVersionNumber & |
other | ) |
const |
Returns true if this QVersionNumber is greater than or equal to other, otherwise returns false.
- See also
- QVersionNumber::compare()
int QVersionNumber::segmentAt |
( |
int |
index | ) |
const |
|
inline |
int QVersionNumber::segmentCount |
( |
| ) |
const |
|
inline |
QVector< int > QVersionNumber::segments |
( |
| ) |
const |
QString QVersionNumber::toString |
( |
| ) |
const |
Writes the given version to the stream. Returns a reference to the stream. This method is unrelated to QDataStream::version().
Reads from the stream into the given version. Returns a reference to the stream. This method is unrelated to QDataStream::version().