<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qglobal.cpp --> <title>QFlags Class | Qt Core 5.9</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 >Qt 5.9</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QFlags</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 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-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#macros">Macros</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> <li class="level2"><a href="#flags-and-the-meta-object-system">Flags and the Meta-Object System</a></li> <li class="level2"><a href="#naming-convention">Naming Convention</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QFlags Class</h1> <!-- $$$QFlags-brief --> <p>The <a href="qflags.html">QFlags</a> class provides a type-safe way of storing OR-combinations of enum values. <a href="#details">More...</a></p> <!-- @@@QFlags --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QFlags></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr></table></div><ul> <li><a href="qflags-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2 id="public-types">Public Types</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#Int-typedef">Int</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#enum_type-typedef">enum_type</a></b></td></tr> </table></div> <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="qflags.html#QFlags">QFlags</a></b>(const QFlags &<i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#QFlags-1">QFlags</a></b>(Enum <i>flag</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#QFlags-2">QFlags</a></b>(Zero <i>zero</i> = Q_NULLPTR)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#QFlags-3">QFlags</a></b>(QFlag <i>value</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#QFlags-4">QFlags</a></b>(std::initializer_list<Enum> <i>flags</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags &</td><td class="memItemRight bottomAlign"><b><a href="qflags.html#setFlag">setFlag</a></b>(Enum <i>flag</i>, bool <i>on</i> = true)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#testFlag">testFlag</a></b>(Enum <i>flag</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-Int">operator Int</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-not">operator!</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-and">operator&</a></b>(int <i>mask</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-and-1">operator&</a></b>(uint <i>mask</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-and-2">operator&</a></b>(Enum <i>mask</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags &</td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-and-eq">operator&=</a></b>(int <i>mask</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags &</td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-and-eq-1">operator&=</a></b>(uint <i>mask</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags &</td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-and-eq-2">operator&=</a></b>(Enum <i>mask</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags &</td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-eq">operator=</a></b>(const QFlags &<i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-5e">operator^</a></b>(QFlags <i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-5e-1">operator^</a></b>(Enum <i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags &</td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-5e-eq">operator^=</a></b>(QFlags <i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags &</td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-5e-eq-1">operator^=</a></b>(Enum <i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-7c">operator|</a></b>(QFlags <i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-7c-1">operator|</a></b>(Enum <i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags &</td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-7c-eq">operator|=</a></b>(QFlags <i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags &</td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-7c-eq-1">operator|=</a></b>(Enum <i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFlags </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#operator-7e">operator~</a></b>() const</td></tr> </table></div> <a name="macros"></a> <h2 id="macros">Macros</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#Q_DECLARE_FLAGS">Q_DECLARE_FLAGS</a></b>(<i>Flags</i>, <i>Enum</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qflags.html#Q_DECLARE_OPERATORS_FOR_FLAGS">Q_DECLARE_OPERATORS_FOR_FLAGS</a></b>(<i>Flags</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QFlags-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qflags.html">QFlags</a> class provides a type-safe way of storing OR-combinations of enum values.</p> <p>The <a href="qflags.html">QFlags</a><Enum> class is a template class, where Enum is an enum type. <a href="qflags.html">QFlags</a> is used throughout Qt for storing combinations of enum values.</p> <p>The traditional C++ approach for storing OR-combinations of enum values is to use an <code>int</code> or <code>uint</code> variable. The inconvenience with this approach is that there's no type checking at all; any enum value can be OR'd with any other enum value and passed on to a function that takes an <code>int</code> or <code>uint</code>.</p> <p>Qt uses <a href="qflags.html">QFlags</a> to provide type safety. For example, the <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> type is simply a typedef for <a href="qflags.html">QFlags</a><<a href="qt.html#AlignmentFlag-enum">Qt::AlignmentFlag</a>>. <a href="../qtwidgets/qlabel.html#alignment-prop">QLabel::setAlignment</a>() takes a <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> parameter, which means that any combination of <a href="qt.html#AlignmentFlag-enum">Qt::AlignmentFlag</a> values, or 0, is legal:</p> <pre class="cpp"> label<span class="operator">-</span><span class="operator">></span>setAlignment(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>AlignLeft <span class="operator">|</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>AlignTop); </pre> <p>If you try to pass a value from another enum or just a plain integer other than 0, the compiler will report an error. If you need to cast integer values to flags in a untyped fashion, you can use the explicit <a href="qflags.html">QFlags</a> constructor as cast operator.</p> <p>If you want to use <a href="qflags.html">QFlags</a> for your own enum types, use the <a href="qflags.html#Q_DECLARE_FLAGS">Q_DECLARE_FLAGS</a>() and <a href="qflags.html#Q_DECLARE_OPERATORS_FOR_FLAGS">Q_DECLARE_OPERATORS_FOR_FLAGS</a>().</p> <p>Example:</p> <pre class="cpp"> <span class="keyword">class</span> MyClass { <span class="keyword">public</span>: <span class="keyword">enum</span> Option { NoOptions <span class="operator">=</span> <span class="number">0x0</span><span class="operator">,</span> ShowTabs <span class="operator">=</span> <span class="number">0x1</span><span class="operator">,</span> ShowAll <span class="operator">=</span> <span class="number">0x2</span><span class="operator">,</span> SqueezeBlank <span class="operator">=</span> <span class="number">0x4</span> }; Q_DECLARE_FLAGS(Options<span class="operator">,</span> Option) <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> }; Q_DECLARE_OPERATORS_FOR_FLAGS(MyClass<span class="operator">::</span>Options) </pre> <p>You can then use the <code>MyClass::Options</code> type to store combinations of <code>MyClass::Option</code> values.</p> <a name="flags-and-the-meta-object-system"></a> <h3 >Flags and the Meta-Object System</h3> <p>The <a href="qflags.html#Q_DECLARE_FLAGS">Q_DECLARE_FLAGS</a>() macro does not expose the flags to the meta-object system, so they cannot be used by Qt Script or edited in Qt Designer. To make the flags available for these purposes, the <a href="qobject.html#Q_FLAG">Q_FLAG</a>() macro must be used:</p> <pre class="cpp"> Q_FLAG(Options) </pre> <a name="naming-convention"></a> <h3 >Naming Convention</h3> <p>A sensible naming convention for enum types and associated <a href="qflags.html">QFlags</a> types is to give a singular name to the enum type (e.g., <code>Option</code>) and a plural name to the <a href="qflags.html">QFlags</a> type (e.g., <code>Options</code>). When a singular name is desired for the <a href="qflags.html">QFlags</a> type (e.g., <code>Alignment</code>), you can use <code>Flag</code> as the suffix for the enum type (e.g., <code>AlignmentFlag</code>).</p> </div> <p><b>See also </b><a href="qflag.html">QFlag</a>.</p> <!-- @@@QFlags --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$Int --> <h3 class="fn" id="Int-typedef"><a name="Int-typedef"></a>typedef QFlags::<span class="name">Int</span></h3> <p>Typedef for the integer type used for storage as well as for implicit conversion. Either <code>int</code> or <code>unsigned int</code>, depending on whether the enum's underlying type is signed or unsigned.</p> <p>This typedef was introduced in Qt 5.0.</p> <!-- @@@Int --> <!-- $$$enum_type --> <h3 class="fn" id="enum_type-typedef"><a name="enum_type-typedef"></a>typedef QFlags::<span class="name">enum_type</span></h3> <p>Typedef for the Enum template type.</p> <!-- @@@enum_type --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QFlags[overload1]$$$QFlagsconstQFlags& --> <h3 class="fn" id="QFlags"><a name="QFlags"></a>QFlags::<span class="name">QFlags</span>(const <span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &<i>other</i>)</h3> <p>Constructs a copy of <i>other</i>.</p> <!-- @@@QFlags --> <!-- $$$QFlags$$$QFlagsEnum --> <h3 class="fn" id="QFlags-1"><a name="QFlags-1"></a>QFlags::<span class="name">QFlags</span>(<span class="type">Enum</span> <i>flag</i>)</h3> <p>Constructs a <a href="qflags.html">QFlags</a> object storing the given <i>flag</i>.</p> <!-- @@@QFlags --> <!-- $$$QFlags$$$QFlagsZero --> <h3 class="fn" id="QFlags-2"><a name="QFlags-2"></a>QFlags::<span class="name">QFlags</span>(<span class="type">Zero</span> <i>zero</i> = Q_NULLPTR)</h3> <p>Constructs a <a href="qflags.html">QFlags</a> object with no flags set. <i>zero</i> must be a literal 0 value.</p> <!-- @@@QFlags --> <!-- $$$QFlags$$$QFlagsQFlag --> <h3 class="fn" id="QFlags-3"><a name="QFlags-3"></a>QFlags::<span class="name">QFlags</span>(<span class="type"><a href="qflag.html">QFlag</a></span> <i>value</i>)</h3> <p>Constructs a <a href="qflags.html">QFlags</a> object initialized with the given integer <i>value</i>.</p> <p>The <a href="qflag.html">QFlag</a> type is a helper type. By using it here instead of <code>int</code>, we effectively ensure that arbitrary enum values cannot be cast to a <a href="qflags.html">QFlags</a>, whereas untyped enum values (i.e., <code>int</code> values) can.</p> <!-- @@@QFlags --> <!-- $$$QFlags$$$QFlagsstd::initializer_list<Enum> --> <h3 class="fn" id="QFlags-4"><a name="QFlags-4"></a>QFlags::<span class="name">QFlags</span>(<span class="type">std::initializer_list</span><<span class="type">Enum</span>> <i>flags</i>)</h3> <p>Constructs a <a href="qflags.html">QFlags</a> object initialized with all <i>flags</i> combined using the bitwise OR operator.</p> <p>This function was introduced in Qt 5.4.</p> <p><b>See also </b><a href="qflags.html#operator-7c-eq">operator|=</a>() and <a href="qflags.html#operator-7c">operator|</a>().</p> <!-- @@@QFlags --> <!-- $$$setFlag[overload1]$$$setFlagEnumbool --> <h3 class="fn" id="setFlag"><a name="setFlag"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &QFlags::<span class="name">setFlag</span>(<span class="type">Enum</span> <i>flag</i>, <span class="type">bool</span> <i>on</i> = true)</h3> <p>Sets the indicated <i>flag</i> if <i>on</i> is <code>true</code> or unsets it if <i>on</i> is <code>false</code>. Returns a reference to this object.</p> <p>This function was introduced in Qt 5.7.</p> <!-- @@@setFlag --> <!-- $$$testFlag[overload1]$$$testFlagEnum --> <h3 class="fn" id="testFlag"><a name="testFlag"></a><span class="type">bool</span> QFlags::<span class="name">testFlag</span>(<span class="type">Enum</span> <i>flag</i>) const</h3> <p>Returns <code>true</code> if the <i>flag</i> is set, otherwise <code>false</code>.</p> <p>This function was introduced in Qt 4.2.</p> <!-- @@@testFlag --> <!-- $$$operator Int[overload1]$$$operator Int --> <h3 class="fn" id="operator-Int"><a name="operator-Int"></a>QFlags::<span class="name">operator Int</span>() const</h3> <p>Returns the value stored in the <a href="qflags.html">QFlags</a> object as an integer.</p> <p><b>See also </b><a href="qflags.html#Int-typedef">Int</a>.</p> <!-- @@@operator Int --> <!-- $$$operator![overload1]$$$operator! --> <h3 class="fn" id="operator-not"><a name="operator-not"></a><span class="type">bool</span> QFlags::<span class="name">operator!</span>() const</h3> <p>Returns <code>true</code> if no flag is set (i.e., if the value stored by the <a href="qflags.html">QFlags</a> object is 0); otherwise returns <code>false</code>.</p> <!-- @@@operator! --> <!-- $$$operator&[overload1]$$$operator&int --> <h3 class="fn" id="operator-and"><a name="operator-and"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> QFlags::<span class="name">operator&</span>(<span class="type">int</span> <i>mask</i>) const</h3> <p>Returns a <a href="qflags.html">QFlags</a> object containing the result of the bitwise AND operation on this object and <i>mask</i>.</p> <p><b>See also </b><a href="qflags.html#operator-and-eq">operator&=</a>(), <a href="qflags.html#operator-7c">operator|</a>(), <a href="qflags.html#operator-5e">operator^</a>(), and <a href="qflags.html#operator-7e">operator~</a>().</p> <!-- @@@operator& --> <!-- $$$operator&$$$operator&uint --> <h3 class="fn" id="operator-and-1"><a name="operator-and-1"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> QFlags::<span class="name">operator&</span>(<span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>mask</i>) const</h3> <p>This is an overloaded function.</p> <!-- @@@operator& --> <!-- $$$operator&$$$operator&Enum --> <h3 class="fn" id="operator-and-2"><a name="operator-and-2"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> QFlags::<span class="name">operator&</span>(<span class="type">Enum</span> <i>mask</i>) const</h3> <p>This is an overloaded function.</p> <!-- @@@operator& --> <!-- $$$operator&=[overload1]$$$operator&=int --> <h3 class="fn" id="operator-and-eq"><a name="operator-and-eq"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &QFlags::<span class="name">operator&=</span>(<span class="type">int</span> <i>mask</i>)</h3> <p>Performs a bitwise AND operation with <i>mask</i> and stores the result in this <a href="qflags.html">QFlags</a> object. Returns a reference to this object.</p> <p><b>See also </b><a href="qflags.html#operator-and">operator&</a>(), <a href="qflags.html#operator-7c-eq">operator|=</a>(), and <a href="qflags.html#operator-5e-eq">operator^=</a>().</p> <!-- @@@operator&= --> <!-- $$$operator&=$$$operator&=uint --> <h3 class="fn" id="operator-and-eq-1"><a name="operator-and-eq-1"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &QFlags::<span class="name">operator&=</span>(<span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>mask</i>)</h3> <p>This is an overloaded function.</p> <!-- @@@operator&= --> <!-- $$$operator&=$$$operator&=Enum --> <h3 class="fn" id="operator-and-eq-2"><a name="operator-and-eq-2"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &QFlags::<span class="name">operator&=</span>(<span class="type">Enum</span> <i>mask</i>)</h3> <p>This is an overloaded function.</p> <!-- @@@operator&= --> <!-- $$$operator=[overload1]$$$operator=constQFlags& --> <h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &QFlags::<span class="name">operator=</span>(const <span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &<i>other</i>)</h3> <p>Assigns <i>other</i> to this object and returns a reference to this object.</p> <!-- @@@operator= --> <!-- $$$operator^[overload1]$$$operator^QFlags --> <h3 class="fn" id="operator-5e"><a name="operator-5e"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> QFlags::<span class="name">operator^</span>(<span class="type"><a href="qflags.html#QFlags">QFlags</a></span> <i>other</i>) const</h3> <p>Returns a <a href="qflags.html">QFlags</a> object containing the result of the bitwise XOR operation on this object and <i>other</i>.</p> <p><b>See also </b><a href="qflags.html#operator-5e-eq">operator^=</a>(), <a href="qflags.html#operator-and">operator&</a>(), <a href="qflags.html#operator-7c">operator|</a>(), and <a href="qflags.html#operator-7e">operator~</a>().</p> <!-- @@@operator^ --> <!-- $$$operator^$$$operator^Enum --> <h3 class="fn" id="operator-5e-1"><a name="operator-5e-1"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> QFlags::<span class="name">operator^</span>(<span class="type">Enum</span> <i>other</i>) const</h3> <p>This is an overloaded function.</p> <!-- @@@operator^ --> <!-- $$$operator^=[overload1]$$$operator^=QFlags --> <h3 class="fn" id="operator-5e-eq"><a name="operator-5e-eq"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &QFlags::<span class="name">operator^=</span>(<span class="type"><a href="qflags.html#QFlags">QFlags</a></span> <i>other</i>)</h3> <p>Performs a bitwise XOR operation with <i>other</i> and stores the result in this <a href="qflags.html">QFlags</a> object. Returns a reference to this object.</p> <p><b>See also </b><a href="qflags.html#operator-5e">operator^</a>(), <a href="qflags.html#operator-and-eq">operator&=</a>(), and <a href="qflags.html#operator-7c-eq">operator|=</a>().</p> <!-- @@@operator^= --> <!-- $$$operator^=$$$operator^=Enum --> <h3 class="fn" id="operator-5e-eq-1"><a name="operator-5e-eq-1"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &QFlags::<span class="name">operator^=</span>(<span class="type">Enum</span> <i>other</i>)</h3> <p>This is an overloaded function.</p> <!-- @@@operator^= --> <!-- $$$operator|[overload1]$$$operator|QFlags --> <h3 class="fn" id="operator-7c"><a name="operator-7c"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> QFlags::<span class="name">operator|</span>(<span class="type"><a href="qflags.html#QFlags">QFlags</a></span> <i>other</i>) const</h3> <p>Returns a <a href="qflags.html">QFlags</a> object containing the result of the bitwise OR operation on this object and <i>other</i>.</p> <p><b>See also </b><a href="qflags.html#operator-7c-eq">operator|=</a>(), <a href="qflags.html#operator-5e">operator^</a>(), <a href="qflags.html#operator-and">operator&</a>(), and <a href="qflags.html#operator-7e">operator~</a>().</p> <!-- @@@operator| --> <!-- $$$operator|$$$operator|Enum --> <h3 class="fn" id="operator-7c-1"><a name="operator-7c-1"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> QFlags::<span class="name">operator|</span>(<span class="type">Enum</span> <i>other</i>) const</h3> <p>This is an overloaded function.</p> <!-- @@@operator| --> <!-- $$$operator|=[overload1]$$$operator|=QFlags --> <h3 class="fn" id="operator-7c-eq"><a name="operator-7c-eq"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &QFlags::<span class="name">operator|=</span>(<span class="type"><a href="qflags.html#QFlags">QFlags</a></span> <i>other</i>)</h3> <p>Performs a bitwise OR operation with <i>other</i> and stores the result in this <a href="qflags.html">QFlags</a> object. Returns a reference to this object.</p> <p><b>See also </b><a href="qflags.html#operator-7c">operator|</a>(), <a href="qflags.html#operator-and-eq">operator&=</a>(), and <a href="qflags.html#operator-5e-eq">operator^=</a>().</p> <!-- @@@operator|= --> <!-- $$$operator|=$$$operator|=Enum --> <h3 class="fn" id="operator-7c-eq-1"><a name="operator-7c-eq-1"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> &QFlags::<span class="name">operator|=</span>(<span class="type">Enum</span> <i>other</i>)</h3> <p>This is an overloaded function.</p> <!-- @@@operator|= --> <!-- $$$operator~[overload1]$$$operator~ --> <h3 class="fn" id="operator-7e"><a name="operator-7e"></a><span class="type"><a href="qflags.html#QFlags">QFlags</a></span> QFlags::<span class="name">operator~</span>() const</h3> <p>Returns a <a href="qflags.html">QFlags</a> object that contains the bitwise negation of this object.</p> <p><b>See also </b><a href="qflags.html#operator-and">operator&</a>(), <a href="qflags.html#operator-7c">operator|</a>(), and <a href="qflags.html#operator-5e">operator^</a>().</p> <!-- @@@operator~ --> </div> <div class="macros"> <h2>Macro Documentation</h2> <!-- $$$Q_DECLARE_FLAGS[overload1]$$$Q_DECLARE_FLAGS --> <h3 class="fn" id="Q_DECLARE_FLAGS"><a name="Q_DECLARE_FLAGS"></a><span class="name">Q_DECLARE_FLAGS</span>(<i>Flags</i>, <i>Enum</i>)</h3> <p>The Q_DECLARE_FLAGS() macro expands to</p> <pre class="cpp"> <span class="keyword">typedef</span> <span class="type"><a href="qflags.html">QFlags</a></span><span class="operator"><</span>Enum<span class="operator">></span> Flags; </pre> <p><i>Enum</i> is the name of an existing enum type, whereas <i>Flags</i> is the name of the <a href="qflags.html">QFlags</a><<i>Enum</i>> typedef.</p> <p>See the <a href="qflags.html">QFlags</a> documentation for details.</p> <p><b>See also </b><a href="qflags.html#Q_DECLARE_OPERATORS_FOR_FLAGS">Q_DECLARE_OPERATORS_FOR_FLAGS</a>().</p> <!-- @@@Q_DECLARE_FLAGS --> <!-- $$$Q_DECLARE_OPERATORS_FOR_FLAGS[overload1]$$$Q_DECLARE_OPERATORS_FOR_FLAGS --> <h3 class="fn" id="Q_DECLARE_OPERATORS_FOR_FLAGS"><a name="Q_DECLARE_OPERATORS_FOR_FLAGS"></a><span class="name">Q_DECLARE_OPERATORS_FOR_FLAGS</span>(<i>Flags</i>)</h3> <p>The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global <code>operator|()</code> functions for <i>Flags</i>, which is of type <a href="qflags.html">QFlags</a><T>.</p> <p>See the <a href="qflags.html">QFlags</a> documentation for details.</p> <p><b>See also </b><a href="qflags.html#Q_DECLARE_FLAGS">Q_DECLARE_FLAGS</a>().</p> <!-- @@@Q_DECLARE_OPERATORS_FOR_FLAGS --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 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>