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 |
Public Functions
QVersionNumber() | |
QVersionNumber(const QVector<int> &seg) | |
QVersionNumber(QVector<int> &&seg) | |
QVersionNumber(std::initializer_list<int> args) | |
QVersionNumber(int maj) | |
QVersionNumber(int maj, int min) | |
QVersionNumber(int maj, int min, int mic) | |
bool | isNormalized() const |
bool | isNull() const |
bool | isPrefixOf(const QVersionNumber &other) const |
int | majorVersion() const |
int | microVersion() const |
int | minorVersion() const |
QVersionNumber | normalized() const |
int | segmentAt(int index) const |
int | segmentCount() const |
QVector<int> | segments() const |
QString | toString() const |
Static Public Members
QVersionNumber | commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2) |
int | compare(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
The QVersionNumber class contains a version number with an arbitrary number of segments.
QVersionNumber version(1, 2, 3); // 1.2.3
Member Type Documentation
Property Documentation
Member Function Documentation
QVersionNumber::QVersionNumber()
Default constructs an instance of QVersionNumber.
QVersionNumber::QVersionNumber(const QVector<int> &seg)
Default constructs an instance of QVersionNumber.
QVersionNumber::QVersionNumber(QVector<int> &&seg)
Default constructs an instance of QVersionNumber.
QVersionNumber::QVersionNumber(std::initializer_list<int> args)
Default constructs an instance of QVersionNumber.
QVersionNumber::QVersionNumber(int maj)
Default constructs an instance of QVersionNumber.
QVersionNumber::QVersionNumber(int maj, int min)
Default constructs an instance of QVersionNumber.
QVersionNumber::QVersionNumber(int maj, int min, int mic)
Default constructs an instance of QVersionNumber.
[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]
int QVersionNumber::compare(const QVersionNumber &v1, const QVersionNumber &v2)
[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().