QVersionNumber Class
The QVersionNumber class contains a version number with an arbitrary number of segments. More...
Header: | #include <QVersionNumber> |
qmake: | QT += core |
Since: | Qt 5.6 |
This class was introduced in Qt 5.6.
Static Public Members
QVersionNumber | commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2) |
QVersionNumber | fromString(const QString &string, int *suffixIndex = nullptr) |
QVersionNumber | fromString(QLatin1String string, int *suffixIndex = nullptr) |
QVersionNumber | fromString(QStringView string, int *suffixIndex = nullptr) |
Related Non-Members
bool | operator!=(const int &lhs, const int &rhs) |
bool | operator==(const int &lhs, const int &rhs) |
Detailed Description
QVersionNumber version(1, 2, 3); // 1.2.3
Member Function Documentation
[static]
QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2)
QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2)
Returns a version number that is a parent version of both v1 and v2.
See also isPrefixOf().
[static]
QVersionNumber QVersionNumber::fromString(const QString &string, int *suffixIndex = nullptr)
Constructs a QVersionNumber from a specially formatted string of non-negative decimal numbers delimited by a period (.
).
Once the numerical segments have been parsed, the remainder of the string is considered to be the suffix string. The start index of that string will be stored in suffixIndex if it is not null.
QString string("5.4.0-alpha"); int suffixIndex; QVersionNumber version = QVersionNumber::fromString(string, &suffixIndex); // version is 5.4.0 // suffixIndex is 5
See also isNull().
[static]
QVersionNumber QVersionNumber::fromString(QLatin1String string, int *suffixIndex = nullptr)
This is an overloaded function.
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 that string will be stored in suffixIndex if it is not null.
QLatin1String string("5.4.0-alpha"); int suffixIndex; auto version = QVersionNumber::fromString(string, &suffixIndex); // version is 5.4.0 // suffixIndex is 5
This function was introduced in Qt 5.10.
See also isNull().
[static]
QVersionNumber QVersionNumber::fromString(QStringView string, int *suffixIndex = nullptr)
This is an overloaded function.
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 that string will be stored in suffixIndex if it is not null.
QString string("5.4.0-alpha"); int suffixIndex; QVersionNumber version = QVersionNumber::fromString(string, &suffixIndex); // version is 5.4.0 // suffixIndex is 5
This function was introduced in Qt 5.10.
See also isNull().
Related Non-Members
bool QVersionNumber::operator!=(const int &lhs, const int &rhs)
Returns true
if the two arrays, specified by left and right, are not equal.
Two arrays are considered equal if they contain the same values in the same order.
This function requires the value type to have an implementation of operator==()
.
This function was introduced in Qt 4.8.
See also operator==().
bool QVersionNumber::operator==(const int &lhs, const int &rhs)
Returns true
if the two arrays, specified by left and right, are equal.
Two arrays are considered equal if they contain the same values in the same order.
This function requires the value type to have an implementation of operator==()
.
This function was introduced in Qt 4.8.
See also operator!=().