<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qversionnumber.cpp --> <title>QVersionNumber Class | Qt Core 5.11</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QVersionNumber</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.11.2 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#related-non-members">Related Non-Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QVersionNumber Class</h1> <!-- $$$QVersionNumber-brief --> <p>The <a href="qversionnumber.html">QVersionNumber</a> class contains a version number with an arbitrary number of segments. <a href="#details">More...</a></p> <!-- @@@QVersionNumber --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QVersionNumber></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.6</td></tr></table></div><ul> <li><a href="qversionnumber-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#QVersionNumber-1">QVersionNumber</a></b>(const QVector<int> &<i>seg</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#QVersionNumber-2">QVersionNumber</a></b>(QVector<int> &&<i>seg</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#QVersionNumber-3">QVersionNumber</a></b>(std::initializer_list<int> <i>args</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#QVersionNumber-4">QVersionNumber</a></b>(int <i>maj</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#QVersionNumber-5">QVersionNumber</a></b>(int <i>maj</i>, int <i>min</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#QVersionNumber-6">QVersionNumber</a></b>(int <i>maj</i>, int <i>min</i>, int <i>mic</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#isNormalized">isNormalized</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#isNull">isNull</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#isPrefixOf">isPrefixOf</a></b>(const QVersionNumber &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#majorVersion">majorVersion</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#microVersion">microVersion</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#minorVersion">minorVersion</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QVersionNumber </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#normalized">normalized</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#segmentAt">segmentAt</a></b>(int <i>index</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#segmentCount">segmentCount</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QVector<int> </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#segments">segments</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#toString">toString</a></b>() const</td></tr> </table></div> <a name="static-public-members"></a> <h2 id="static-public-members">Static Public Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> QVersionNumber </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#commonPrefix">commonPrefix</a></b>(const QVersionNumber &<i>v1</i>, const QVersionNumber &<i>v2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#compare">compare</a></b>(const QVersionNumber &<i>v1</i>, const QVersionNumber &<i>v2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QVersionNumber </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#fromString">fromString</a></b>(const QString &<i>string</i>, int *<i>suffixIndex</i> = nullptr)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QVersionNumber </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#fromString-1">fromString</a></b>(QLatin1String <i>string</i>, int *<i>suffixIndex</i> = nullptr)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QVersionNumber </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#fromString-2">fromString</a></b>(QStringView <i>string</i>, int *<i>suffixIndex</i> = nullptr)</td></tr> </table></div> <a name="related-non-members"></a> <h2 id="related-non-members">Related Non-Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#operator-not-eq">operator!=</a></b>(const QVersionNumber &<i>lhs</i>, const QVersionNumber &<i>rhs</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#operator-lt">operator<</a></b>(const QVersionNumber &<i>lhs</i>, const QVersionNumber &<i>rhs</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDataStream &</td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#operator-lt-lt">operator<<</a></b>(QDataStream &<i>out</i>, const QVersionNumber &<i>version</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#operator-lt-eq">operator<=</a></b>(const QVersionNumber &<i>lhs</i>, const QVersionNumber &<i>rhs</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#operator-eq-eq">operator==</a></b>(const QVersionNumber &<i>lhs</i>, const QVersionNumber &<i>rhs</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#operator-gt">operator></a></b>(const QVersionNumber &<i>lhs</i>, const QVersionNumber &<i>rhs</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#operator-gt-eq">operator>=</a></b>(const QVersionNumber &<i>lhs</i>, const QVersionNumber &<i>rhs</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDataStream &</td><td class="memItemRight bottomAlign"><b><a href="qversionnumber.html#operator-gt-gt">operator>></a></b>(QDataStream &<i>in</i>, QVersionNumber &<i>version</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QVersionNumber-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qversionnumber.html">QVersionNumber</a> class contains a version number with an arbitrary number of segments.</p> <pre class="cpp"> <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> version(<span class="number">1</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">3</span>); <span class="comment">// 1.2.3</span> </pre> </div> <!-- @@@QVersionNumber --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QVersionNumber[overload1]$$$QVersionNumber --> <h3 class="fn" id="QVersionNumber"><a name="QVersionNumber"></a>QVersionNumber::<span class="name">QVersionNumber</span>()</h3> <p>Produces a null version.</p> <p><b>See also </b><a href="qversionnumber.html#isNull">isNull</a>().</p> <!-- @@@QVersionNumber --> <!-- $$$QVersionNumber$$$QVersionNumberconstQVector<int>& --> <h3 class="fn" id="QVersionNumber-1"><a name="QVersionNumber-1"></a>QVersionNumber::<span class="name">QVersionNumber</span>(const <span class="type"><a href="qvector.html">QVector</a></span><<span class="type">int</span>> &<i>seg</i>)</h3> <p>Constructs a version number from the list of numbers contained in <i>seg</i>.</p> <!-- @@@QVersionNumber --> <!-- $$$QVersionNumber$$$QVersionNumberQVector<int>&& --> <h3 class="fn" id="QVersionNumber-2"><a name="QVersionNumber-2"></a>QVersionNumber::<span class="name">QVersionNumber</span>(<span class="type"><a href="qvector.html">QVector</a></span><<span class="type">int</span>> &&<i>seg</i>)</h3> <p>Move-constructs a version number from the list of numbers contained in <i>seg</i>.</p> <p>This constructor is only enabled if the compiler supports C++11 move semantics.</p> <!-- @@@QVersionNumber --> <!-- $$$QVersionNumber$$$QVersionNumberstd::initializer_list<int> --> <h3 class="fn" id="QVersionNumber-3"><a name="QVersionNumber-3"></a>QVersionNumber::<span class="name">QVersionNumber</span>(<span class="type">std::initializer_list</span><<span class="type">int</span>> <i>args</i>)</h3> <p>Construct a version number from the std::initializer_list specified by <i>args</i>.</p> <p>This constructor is only enabled if the compiler supports C++11 initializer lists.</p> <!-- @@@QVersionNumber --> <!-- $$$QVersionNumber$$$QVersionNumberint --> <h3 class="fn" id="QVersionNumber-4"><a name="QVersionNumber-4"></a>QVersionNumber::<span class="name">QVersionNumber</span>(<span class="type">int</span> <i>maj</i>)</h3> <p>Constructs a <a href="qversionnumber.html">QVersionNumber</a> consisting of just the major version number <i>maj</i>.</p> <!-- @@@QVersionNumber --> <!-- $$$QVersionNumber$$$QVersionNumberintint --> <h3 class="fn" id="QVersionNumber-5"><a name="QVersionNumber-5"></a>QVersionNumber::<span class="name">QVersionNumber</span>(<span class="type">int</span> <i>maj</i>, <span class="type">int</span> <i>min</i>)</h3> <p>Constructs a <a href="qversionnumber.html">QVersionNumber</a> consisting of the major and minor version numbers <i>maj</i> and <i>min</i>, respectively.</p> <!-- @@@QVersionNumber --> <!-- $$$QVersionNumber$$$QVersionNumberintintint --> <h3 class="fn" id="QVersionNumber-6"><a name="QVersionNumber-6"></a>QVersionNumber::<span class="name">QVersionNumber</span>(<span class="type">int</span> <i>maj</i>, <span class="type">int</span> <i>min</i>, <span class="type">int</span> <i>mic</i>)</h3> <p>Constructs a <a href="qversionnumber.html">QVersionNumber</a> consisting of the major, minor, and micro version numbers <i>maj</i>, <i>min</i> and <i>mic</i>, respectively.</p> <!-- @@@QVersionNumber --> <!-- $$$commonPrefix[overload1]$$$commonPrefixconstQVersionNumber&constQVersionNumber& --> <h3 class="fn" id="commonPrefix"><a name="commonPrefix"></a><code>[static] </code><span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> QVersionNumber::<span class="name">commonPrefix</span>(const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>v1</i>, const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>v2</i>)</h3> <p><a href="qversionnumber.html">QVersionNumber</a> QVersionNumber::commonPrefix(const <a href="qversionnumber.html">QVersionNumber</a> &v1, const <a href="qversionnumber.html">QVersionNumber</a> &v2)</p> <p>Returns a version number that is a parent version of both <i>v1</i> and <i>v2</i>.</p> <p><b>See also </b><a href="qversionnumber.html#isPrefixOf">isPrefixOf</a>().</p> <!-- @@@commonPrefix --> <!-- $$$compare[overload1]$$$compareconstQVersionNumber&constQVersionNumber& --> <h3 class="fn" id="compare"><a name="compare"></a><code>[static] </code><span class="type">int</span> QVersionNumber::<span class="name">compare</span>(const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>v1</i>, const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>v2</i>)</h3> <p>Compares <i>v1</i> with <i>v2</i> and returns an integer less than, equal to, or greater than zero, depending on whether <i>v1</i> is less than, equal to, or greater than <i>v2</i>, respectively.</p> <p>Comparisons are performed by comparing the segments of <i>v1</i> and <i>v2</i> starting at index 0 and working towards the end of the longer list.</p> <pre class="cpp"> <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> v1(<span class="number">1</span><span class="operator">,</span> <span class="number">2</span>); <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> v2(<span class="number">1</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">0</span>); <span class="type">int</span> compare <span class="operator">=</span> <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span><span class="operator">::</span>compare(v1<span class="operator">,</span> v2); <span class="comment">// compare == -1</span> </pre> <!-- @@@compare --> <!-- $$$fromString[overload1]$$$fromStringconstQString&int* --> <h3 class="fn" id="fromString"><a name="fromString"></a><code>[static] </code><span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> QVersionNumber::<span class="name">fromString</span>(const <span class="type"><a href="qstring.html">QString</a></span> &<i>string</i>, <span class="type">int</span> *<i>suffixIndex</i> = nullptr)</h3> <p>Constructs a <a href="qversionnumber.html">QVersionNumber</a> from a specially formatted <i>string</i> of non-negative decimal numbers delimited by a period (<code>.</code>).</p> <p>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 <i>suffixIndex</i> if it is not null.</p> <pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> string(<span class="string">"5.4.0-alpha"</span>); <span class="type">int</span> suffixIndex; <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> version <span class="operator">=</span> <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span><span class="operator">::</span>fromString(string<span class="operator">,</span> <span class="operator">&</span>suffixIndex); <span class="comment">// version is 5.4.0</span> <span class="comment">// suffixIndex is 5</span> </pre> <p><b>See also </b><a href="qversionnumber.html#isNull">isNull</a>().</p> <!-- @@@fromString --> <!-- $$$fromString$$$fromStringQLatin1Stringint* --> <h3 class="fn" id="fromString-1"><a name="fromString-1"></a><code>[static] </code><span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> QVersionNumber::<span class="name">fromString</span>(<span class="type"><a href="qlatin1string.html">QLatin1String</a></span> <i>string</i>, <span class="type">int</span> *<i>suffixIndex</i> = nullptr)</h3> <p>This is an overloaded function.</p> <p>Constructs a <a href="qversionnumber.html">QVersionNumber</a> from a specially formatted <i>string</i> of non-negative decimal numbers delimited by '.'.</p> <p>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 <i>suffixIndex</i> if it is not null.</p> <pre class="cpp"> QLatin1String string(<span class="string">"5.4.0-alpha"</span>); <span class="type">int</span> suffixIndex; <span class="keyword">auto</span> version <span class="operator">=</span> <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span><span class="operator">::</span>fromString(string<span class="operator">,</span> <span class="operator">&</span>suffixIndex); <span class="comment">// version is 5.4.0</span> <span class="comment">// suffixIndex is 5</span> </pre> <p>This function was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qversionnumber.html#isNull">isNull</a>().</p> <!-- @@@fromString --> <!-- $$$fromString$$$fromStringQStringViewint* --> <h3 class="fn" id="fromString-2"><a name="fromString-2"></a><code>[static] </code><span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> QVersionNumber::<span class="name">fromString</span>(<span class="type"><a href="qstringview.html">QStringView</a></span> <i>string</i>, <span class="type">int</span> *<i>suffixIndex</i> = nullptr)</h3> <p>This is an overloaded function.</p> <p>Constructs a <a href="qversionnumber.html">QVersionNumber</a> from a specially formatted <i>string</i> of non-negative decimal numbers delimited by '.'.</p> <p>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 <i>suffixIndex</i> if it is not null.</p> <pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> string(<span class="string">"5.4.0-alpha"</span>); <span class="type">int</span> suffixIndex; <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> version <span class="operator">=</span> <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span><span class="operator">::</span>fromString(string<span class="operator">,</span> <span class="operator">&</span>suffixIndex); <span class="comment">// version is 5.4.0</span> <span class="comment">// suffixIndex is 5</span> </pre> <p>This function was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qversionnumber.html#isNull">isNull</a>().</p> <!-- @@@fromString --> <!-- $$$isNormalized[overload1]$$$isNormalized --> <h3 class="fn" id="isNormalized"><a name="isNormalized"></a><span class="type">bool</span> QVersionNumber::<span class="name">isNormalized</span>() const</h3> <p>Returns <code>true</code> if the version number does not contain any trailing zeros, otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qversionnumber.html#normalized">normalized</a>().</p> <!-- @@@isNormalized --> <!-- $$$isNull[overload1]$$$isNull --> <h3 class="fn" id="isNull"><a name="isNull"></a><span class="type">bool</span> QVersionNumber::<span class="name">isNull</span>() const</h3> <p>Returns <code>true</code> if there are zero numerical segments, otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qversionnumber.html#segments">segments</a>().</p> <!-- @@@isNull --> <!-- $$$isPrefixOf[overload1]$$$isPrefixOfconstQVersionNumber& --> <h3 class="fn" id="isPrefixOf"><a name="isPrefixOf"></a><span class="type">bool</span> QVersionNumber::<span class="name">isPrefixOf</span>(const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>other</i>) const</h3> <p>Returns <code>true</code> if the current version number is contained in the <i>other</i> version number, otherwise returns <code>false</code>.</p> <pre class="cpp"> <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> v1(<span class="number">5</span><span class="operator">,</span> <span class="number">3</span>); <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> v2(<span class="number">5</span><span class="operator">,</span> <span class="number">3</span><span class="operator">,</span> <span class="number">1</span>); bool value <span class="operator">=</span> v1<span class="operator">.</span>isPrefixOf(v2); <span class="comment">// true</span> </pre> <p><b>See also </b><a href="qversionnumber.html#commonPrefix">commonPrefix</a>().</p> <!-- @@@isPrefixOf --> <!-- $$$majorVersion[overload1]$$$majorVersion --> <h3 class="fn" id="majorVersion"><a name="majorVersion"></a><span class="type">int</span> QVersionNumber::<span class="name">majorVersion</span>() const</h3> <p>Returns the major version number, that is, the first segment. This function is equivalent to <a href="qversionnumber.html#segmentAt">segmentAt</a>(0). If this <a href="qversionnumber.html">QVersionNumber</a> object is null, this function returns 0.</p> <p><b>See also </b><a href="qversionnumber.html#isNull">isNull</a>() and <a href="qversionnumber.html#segmentAt">segmentAt</a>().</p> <!-- @@@majorVersion --> <!-- $$$microVersion[overload1]$$$microVersion --> <h3 class="fn" id="microVersion"><a name="microVersion"></a><span class="type">int</span> QVersionNumber::<span class="name">microVersion</span>() const</h3> <p>Returns the micro version number, that is, the third segment. This function is equivalent to <a href="qversionnumber.html#segmentAt">segmentAt</a>(2). If this <a href="qversionnumber.html">QVersionNumber</a> object does not contain a micro number, this function returns 0.</p> <p><b>See also </b><a href="qversionnumber.html#isNull">isNull</a>() and <a href="qversionnumber.html#segmentAt">segmentAt</a>().</p> <!-- @@@microVersion --> <!-- $$$minorVersion[overload1]$$$minorVersion --> <h3 class="fn" id="minorVersion"><a name="minorVersion"></a><span class="type">int</span> QVersionNumber::<span class="name">minorVersion</span>() const</h3> <p>Returns the minor version number, that is, the second segment. This function is equivalent to <a href="qversionnumber.html#segmentAt">segmentAt</a>(1). If this <a href="qversionnumber.html">QVersionNumber</a> object does not contain a minor number, this function returns 0.</p> <p><b>See also </b><a href="qversionnumber.html#isNull">isNull</a>() and <a href="qversionnumber.html#segmentAt">segmentAt</a>().</p> <!-- @@@minorVersion --> <!-- $$$normalized[overload1]$$$normalized --> <h3 class="fn" id="normalized"><a name="normalized"></a><span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> QVersionNumber::<span class="name">normalized</span>() const</h3> <p>Returns an equivalent version number but with all trailing zeros removed.</p> <p>To check if two numbers are equivalent, use normalized() on both version numbers before performing the compare.</p> <pre class="cpp"> <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> v1(<span class="number">5</span><span class="operator">,</span> <span class="number">4</span>); <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> v2(<span class="number">5</span><span class="operator">,</span> <span class="number">4</span><span class="operator">,</span> <span class="number">0</span>); bool equivalent <span class="operator">=</span> v1<span class="operator">.</span>normalized() <span class="operator">=</span><span class="operator">=</span> v2<span class="operator">.</span>normalized(); bool equal <span class="operator">=</span> v1 <span class="operator">=</span><span class="operator">=</span> v2; <span class="comment">// equivalent is true</span> <span class="comment">// equal is false</span> </pre> <!-- @@@normalized --> <!-- $$$segmentAt[overload1]$$$segmentAtint --> <h3 class="fn" id="segmentAt"><a name="segmentAt"></a><span class="type">int</span> QVersionNumber::<span class="name">segmentAt</span>(<span class="type">int</span> <i>index</i>) const</h3> <p>Returns the segement value at <i>index</i>. If the index does not exist, returns 0.</p> <p><b>See also </b><a href="qversionnumber.html#segments">segments</a>() and <a href="qversionnumber.html#segmentCount">segmentCount</a>().</p> <!-- @@@segmentAt --> <!-- $$$segmentCount[overload1]$$$segmentCount --> <h3 class="fn" id="segmentCount"><a name="segmentCount"></a><span class="type">int</span> QVersionNumber::<span class="name">segmentCount</span>() const</h3> <p>Returns the number of integers stored in <a href="qversionnumber.html#segments">segments</a>().</p> <p><b>See also </b><a href="qversionnumber.html#segments">segments</a>().</p> <!-- @@@segmentCount --> <!-- $$$segments[overload1]$$$segments --> <h3 class="fn" id="segments"><a name="segments"></a><span class="type"><a href="qvector.html">QVector</a></span><<span class="type">int</span>> QVersionNumber::<span class="name">segments</span>() const</h3> <p>Returns all of the numerical segments.</p> <p><b>See also </b><a href="qversionnumber.html#majorVersion">majorVersion</a>(), <a href="qversionnumber.html#minorVersion">minorVersion</a>(), and <a href="qversionnumber.html#microVersion">microVersion</a>().</p> <!-- @@@segments --> <!-- $$$toString[overload1]$$$toString --> <h3 class="fn" id="toString"><a name="toString"></a><span class="type"><a href="qstring.html">QString</a></span> QVersionNumber::<span class="name">toString</span>() const</h3> <p>Returns a string with all of the segments delimited by a period (<code>.</code>).</p> <p><b>See also </b><a href="qversionnumber.html#majorVersion">majorVersion</a>(), <a href="qversionnumber.html#minorVersion">minorVersion</a>(), <a href="qversionnumber.html#microVersion">microVersion</a>(), and <a href="qversionnumber.html#segments">segments</a>().</p> <!-- @@@toString --> </div> <div class="relnonmem"> <h2>Related Non-Members</h2> <!-- $$$operator!=[overload1]$$$operator!=constQVersionNumber&constQVersionNumber& --> <h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> <span class="name">operator!=</span>(const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>lhs</i>, const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>rhs</i>)</h3> <p>Returns <code>true</code> if <i>lhs</i> is not equal to <i>rhs</i>; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qversionnumber.html#compare">QVersionNumber::compare</a>().</p> <!-- @@@operator!= --> <!-- $$$operator<[overload1]$$$operator<constQVersionNumber&constQVersionNumber& --> <h3 class="fn" id="operator-lt"><a name="operator-lt"></a><span class="type">bool</span> <span class="name">operator<</span>(const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>lhs</i>, const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>rhs</i>)</h3> <p>Returns <code>true</code> if <i>lhs</i> is less than <i>rhs</i>; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qversionnumber.html#compare">QVersionNumber::compare</a>().</p> <!-- @@@operator< --> <!-- $$$operator<<[overload1]$$$operator<<QDataStream&constQVersionNumber& --> <h3 class="fn" id="operator-lt-lt"><a name="operator-lt-lt"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &<span class="name">operator<<</span>(<span class="type"><a href="qdatastream.html">QDataStream</a></span> &<i>out</i>, const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>version</i>)</h3> <p>Writes the version number <i>version</i> to stream <i>out</i>.</p> <p>Note that this has nothing to do with <a href="qdatastream.html#version">QDataStream::version</a>().</p> <!-- @@@operator<< --> <!-- $$$operator<=[overload1]$$$operator<=constQVersionNumber&constQVersionNumber& --> <h3 class="fn" id="operator-lt-eq"><a name="operator-lt-eq"></a><span class="type">bool</span> <span class="name">operator<=</span>(const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>lhs</i>, const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>rhs</i>)</h3> <p>Returns <code>true</code> if <i>lhs</i> is less than or equal to <i>rhs</i>; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qversionnumber.html#compare">QVersionNumber::compare</a>().</p> <!-- @@@operator<= --> <!-- $$$operator==[overload1]$$$operator==constQVersionNumber&constQVersionNumber& --> <h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> <span class="name">operator==</span>(const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>lhs</i>, const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>rhs</i>)</h3> <p>Returns <code>true</code> if <i>lhs</i> is equal to <i>rhs</i>; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qversionnumber.html#compare">QVersionNumber::compare</a>().</p> <!-- @@@operator== --> <!-- $$$operator>[overload1]$$$operator>constQVersionNumber&constQVersionNumber& --> <h3 class="fn" id="operator-gt"><a name="operator-gt"></a><span class="type">bool</span> <span class="name">operator></span>(const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>lhs</i>, const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>rhs</i>)</h3> <p>Returns <code>true</code> if <i>lhs</i> is greater than <i>rhs</i>; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qversionnumber.html#compare">QVersionNumber::compare</a>().</p> <!-- @@@operator> --> <!-- $$$operator>=[overload1]$$$operator>=constQVersionNumber&constQVersionNumber& --> <h3 class="fn" id="operator-gt-eq"><a name="operator-gt-eq"></a><span class="type">bool</span> <span class="name">operator>=</span>(const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>lhs</i>, const <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>rhs</i>)</h3> <p>Returns <code>true</code> if <i>lhs</i> is greater than or equal to <i>rhs</i>; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qversionnumber.html#compare">QVersionNumber::compare</a>().</p> <!-- @@@operator>= --> <!-- $$$operator>>[overload1]$$$operator>>QDataStream&QVersionNumber& --> <h3 class="fn" id="operator-gt-gt"><a name="operator-gt-gt"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &<span class="name">operator>></span>(<span class="type"><a href="qdatastream.html">QDataStream</a></span> &<i>in</i>, <span class="type"><a href="qversionnumber.html#QVersionNumber">QVersionNumber</a></span> &<i>version</i>)</h3> <p>Reads a version number from stream <i>in</i> and stores it in <i>version</i>.</p> <p>Note that this has nothing to do with <a href="qdatastream.html#version">QDataStream::version</a>().</p> <!-- @@@operator>> --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> 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. </p> </div> </body> </html>