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) |
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().