<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qmetaobject.cpp --> <title>QMetaProperty Class | Qt Core 5.12.2</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.12</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QMetaProperty</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtcore-index.html">Qt 5.12.2 Reference Documentation</a></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="#details">Detailed Description</a></li> <li class="level2"><a href="#property-meta-data">Property Meta-Data</a></li> <li class="level2"><a href="#copying-and-assignment">Copying and Assignment</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QMetaProperty Class</h1> <!-- $$$QMetaProperty-brief --> <p>The <a href="qmetaproperty.html">QMetaProperty</a> class provides meta-data about a property. <a href="#details">More...</a></p> <!-- @@@QMetaProperty --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QMetaProperty></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="qmetaproperty-members.html">List of all members, including inherited members</a></li> <li><a href="qmetaproperty-obsolete.html">Obsolete 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"> QMetaEnum </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#enumerator">enumerator</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#hasNotifySignal">hasNotifySignal</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isConstant">isConstant</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isDesignable">isDesignable</a></b>(const QObject *<i>object</i> = nullptr) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isEnumType">isEnumType</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isFinal">isFinal</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isFlagType">isFlagType</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isReadable">isReadable</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isResettable">isResettable</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isScriptable">isScriptable</a></b>(const QObject *<i>object</i> = nullptr) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isStored">isStored</a></b>(const QObject *<i>object</i> = nullptr) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isUser">isUser</a></b>(const QObject *<i>object</i> = nullptr) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isValid">isValid</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#isWritable">isWritable</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const char *</td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#name">name</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QMetaMethod </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#notifySignal">notifySignal</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#notifySignalIndex">notifySignalIndex</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#propertyIndex">propertyIndex</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#read">read</a></b>(const QObject *<i>object</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#readOnGadget">readOnGadget</a></b>(const void *<i>gadget</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#reset">reset</a></b>(QObject *<i>object</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#resetOnGadget">resetOnGadget</a></b>(void *<i>gadget</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#revision">revision</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QVariant::Type </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#type">type</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const char *</td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#typeName">typeName</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#userType">userType</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#write">write</a></b>(QObject *<i>object</i>, const QVariant &<i>value</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmetaproperty.html#writeOnGadget">writeOnGadget</a></b>(void *<i>gadget</i>, const QVariant &<i>value</i>) const</td></tr> </table></div> <a name="details"></a> <!-- $$$QMetaProperty-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qmetaproperty.html">QMetaProperty</a> class provides meta-data about a property.</p> <p>Property meta-data is obtained from an object's meta-object. See <a href="qmetaobject.html#property">QMetaObject::property</a>() and <a href="qmetaobject.html#propertyCount">QMetaObject::propertyCount</a>() for details.</p> <a name="property-meta-data"></a> <h3 >Property Meta-Data</h3> <p>A property has a <a href="qmetaproperty.html#name">name</a>() and a <a href="qmetaproperty.html#type">type</a>(), as well as various attributes that specify its behavior: <a href="qmetaproperty.html#isReadable">isReadable</a>(), <a href="qmetaproperty.html#isWritable">isWritable</a>(), <a href="qmetaproperty.html#isDesignable">isDesignable</a>(), <a href="qmetaproperty.html#isScriptable">isScriptable</a>(), <a href="qmetaproperty.html#revision">revision</a>(), and <a href="qmetaproperty.html#isStored">isStored</a>().</p> <p>If the property is an enumeration, <a href="qmetaproperty.html#isEnumType">isEnumType</a>() returns <code>true</code>; if the property is an enumeration that is also a flag (i.e. its values can be combined using the OR operator), <a href="qmetaproperty.html#isEnumType">isEnumType</a>() and <a href="qmetaproperty.html#isFlagType">isFlagType</a>() both return true. The enumerator for these types is available from <a href="qmetaproperty.html#enumerator">enumerator</a>().</p> <p>The property's values are set and retrieved with <a href="qmetaproperty.html#read">read</a>(), <a href="qmetaproperty.html#write">write</a>(), and <a href="qmetaproperty.html#reset">reset</a>(); they can also be changed through <a href="qobject.html">QObject</a>'s set and get functions. See <a href="qobject.html#setProperty">QObject::setProperty</a>() and <a href="qobject.html#property">QObject::property</a>() for details.</p> <a name="copying-and-assignment"></a> <h3 >Copying and Assignment</h3> <p><a href="qmetaproperty.html">QMetaProperty</a> objects can be copied by value. However, each copy will refer to the same underlying property meta-data.</p> </div> <p><b>See also </b><a href="qmetaobject.html">QMetaObject</a>, <a href="qmetaenum.html">QMetaEnum</a>, <a href="qmetamethod.html">QMetaMethod</a>, and <a href="properties.html">Qt's Property System</a>.</p> <!-- @@@QMetaProperty --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$enumerator[overload1]$$$enumerator --> <h3 class="fn" id="enumerator"><a name="enumerator"></a><span class="type"><a href="qmetaenum.html">QMetaEnum</a></span> QMetaProperty::<span class="name">enumerator</span>() const</h3> <p>Returns the enumerator if this property's type is an enumerator type; otherwise the returned value is undefined.</p> <p><b>See also </b><a href="qmetaproperty.html#isEnumType">isEnumType</a>() and <a href="qmetaproperty.html#isFlagType">isFlagType</a>().</p> <!-- @@@enumerator --> <!-- $$$hasNotifySignal[overload1]$$$hasNotifySignal --> <h3 class="fn" id="hasNotifySignal"><a name="hasNotifySignal"></a><span class="type">bool</span> QMetaProperty::<span class="name">hasNotifySignal</span>() const</h3> <p>Returns <code>true</code> if this property has a corresponding change notify signal; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qmetaproperty.html#notifySignal">notifySignal</a>().</p> <!-- @@@hasNotifySignal --> <!-- $$$isConstant[overload1]$$$isConstant --> <h3 class="fn" id="isConstant"><a name="isConstant"></a><span class="type">bool</span> QMetaProperty::<span class="name">isConstant</span>() const</h3> <p>Returns <code>true</code> if the property is constant; otherwise returns <code>false</code>.</p> <p>A property is constant if the <code>Q_PROPERTY()</code>'s <code>CONSTANT</code> attribute is set.</p> <p>This function was introduced in Qt 4.6.</p> <!-- @@@isConstant --> <!-- $$$isDesignable[overload1]$$$isDesignableconstQObject* --> <h3 class="fn" id="isDesignable"><a name="isDesignable"></a><span class="type">bool</span> QMetaProperty::<span class="name">isDesignable</span>(const <span class="type"><a href="qobject.html">QObject</a></span> *<i>object</i> = nullptr) const</h3> <p>Returns <code>true</code> if this property is designable for the given <i>object</i>; otherwise returns <code>false</code>.</p> <p>If no <i>object</i> is given, the function returns <code>false</code> if the <code>Q_PROPERTY()</code>'s <code>DESIGNABLE</code> attribute is false; otherwise returns <code>true</code> (if the attribute is true or is a function or expression).</p> <p><b>See also </b><a href="qmetaproperty.html#isScriptable">isScriptable</a>() and <a href="qmetaproperty.html#isStored">isStored</a>().</p> <!-- @@@isDesignable --> <!-- $$$isEnumType[overload1]$$$isEnumType --> <h3 class="fn" id="isEnumType"><a name="isEnumType"></a><span class="type">bool</span> QMetaProperty::<span class="name">isEnumType</span>() const</h3> <p>Returns <code>true</code> if the property's type is an enumeration value; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qmetaproperty.html#enumerator">enumerator</a>() and <a href="qmetaproperty.html#isFlagType">isFlagType</a>().</p> <!-- @@@isEnumType --> <!-- $$$isFinal[overload1]$$$isFinal --> <h3 class="fn" id="isFinal"><a name="isFinal"></a><span class="type">bool</span> QMetaProperty::<span class="name">isFinal</span>() const</h3> <p>Returns <code>true</code> if the property is final; otherwise returns <code>false</code>.</p> <p>A property is final if the <code>Q_PROPERTY()</code>'s <code>FINAL</code> attribute is set.</p> <p>This function was introduced in Qt 4.6.</p> <!-- @@@isFinal --> <!-- $$$isFlagType[overload1]$$$isFlagType --> <h3 class="fn" id="isFlagType"><a name="isFlagType"></a><span class="type">bool</span> QMetaProperty::<span class="name">isFlagType</span>() const</h3> <p>Returns <code>true</code> if the property's type is an enumeration value that is used as a flag; otherwise returns <code>false</code>.</p> <p>Flags can be combined using the OR operator. A flag type is implicitly also an enum type.</p> <p><b>See also </b><a href="qmetaproperty.html#isEnumType">isEnumType</a>(), <a href="qmetaproperty.html#enumerator">enumerator</a>(), and <a href="qmetaenum.html#isFlag">QMetaEnum::isFlag</a>().</p> <!-- @@@isFlagType --> <!-- $$$isReadable[overload1]$$$isReadable --> <h3 class="fn" id="isReadable"><a name="isReadable"></a><span class="type">bool</span> QMetaProperty::<span class="name">isReadable</span>() const</h3> <p>Returns <code>true</code> if this property is readable; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qmetaproperty.html#isWritable">isWritable</a>(), <a href="qmetaproperty.html#read">read</a>(), and <a href="qmetaproperty.html#isValid">isValid</a>().</p> <!-- @@@isReadable --> <!-- $$$isResettable[overload1]$$$isResettable --> <h3 class="fn" id="isResettable"><a name="isResettable"></a><span class="type">bool</span> QMetaProperty::<span class="name">isResettable</span>() const</h3> <p>Returns <code>true</code> if this property can be reset to a default value; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qmetaproperty.html#reset">reset</a>().</p> <!-- @@@isResettable --> <!-- $$$isScriptable[overload1]$$$isScriptableconstQObject* --> <h3 class="fn" id="isScriptable"><a name="isScriptable"></a><span class="type">bool</span> QMetaProperty::<span class="name">isScriptable</span>(const <span class="type"><a href="qobject.html">QObject</a></span> *<i>object</i> = nullptr) const</h3> <p>Returns <code>true</code> if the property is scriptable for the given <i>object</i>; otherwise returns <code>false</code>.</p> <p>If no <i>object</i> is given, the function returns <code>false</code> if the <code>Q_PROPERTY()</code>'s <code>SCRIPTABLE</code> attribute is false; otherwise returns true (if the attribute is true or is a function or expression).</p> <p><b>See also </b><a href="qmetaproperty.html#isDesignable">isDesignable</a>() and <a href="qmetaproperty.html#isStored">isStored</a>().</p> <!-- @@@isScriptable --> <!-- $$$isStored[overload1]$$$isStoredconstQObject* --> <h3 class="fn" id="isStored"><a name="isStored"></a><span class="type">bool</span> QMetaProperty::<span class="name">isStored</span>(const <span class="type"><a href="qobject.html">QObject</a></span> *<i>object</i> = nullptr) const</h3> <p>Returns <code>true</code> if the property is stored for <i>object</i>; otherwise returns false.</p> <p>If no <i>object</i> is given, the function returns <code>false</code> if the <code>Q_PROPERTY()</code>'s <code>STORED</code> attribute is false; otherwise returns true (if the attribute is true or is a function or expression).</p> <p><b>See also </b><a href="qmetaproperty.html#isDesignable">isDesignable</a>() and <a href="qmetaproperty.html#isScriptable">isScriptable</a>().</p> <!-- @@@isStored --> <!-- $$$isUser[overload1]$$$isUserconstQObject* --> <h3 class="fn" id="isUser"><a name="isUser"></a><span class="type">bool</span> QMetaProperty::<span class="name">isUser</span>(const <span class="type"><a href="qobject.html">QObject</a></span> *<i>object</i> = nullptr) const</h3> <p>Returns <code>true</code> if this property is designated as the <code>USER</code> property, i.e., the one that the user can edit for <i>object</i> or that is significant in some other way. Otherwise it returns false. e.g., the <code>text</code> property is the <code>USER</code> editable property of a <a href="../qtwidgets/qlineedit.html">QLineEdit</a>.</p> <p>If <i>object</i> is null, the function returns <code>false</code> if the <code>Q_PROPERTY()</code>'s <code>USER</code> attribute is false. Otherwise it returns true.</p> <p><b>See also </b><a href="qmetaobject.html#userProperty">QMetaObject::userProperty</a>(), <a href="qmetaproperty.html#isDesignable">isDesignable</a>(), and <a href="qmetaproperty.html#isScriptable">isScriptable</a>().</p> <!-- @@@isUser --> <!-- $$$isValid[overload1]$$$isValid --> <h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QMetaProperty::<span class="name">isValid</span>() const</h3> <p>Returns <code>true</code> if this property is valid (readable); otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qmetaproperty.html#isReadable">isReadable</a>().</p> <!-- @@@isValid --> <!-- $$$isWritable[overload1]$$$isWritable --> <h3 class="fn" id="isWritable"><a name="isWritable"></a><span class="type">bool</span> QMetaProperty::<span class="name">isWritable</span>() const</h3> <p>Returns <code>true</code> if this property is writable; otherwise returns false.</p> <p><b>See also </b><a href="qmetaproperty.html#isReadable">isReadable</a>() and <a href="qmetaproperty.html#write">write</a>().</p> <!-- @@@isWritable --> <!-- $$$name[overload1]$$$name --> <h3 class="fn" id="name"><a name="name"></a>const <span class="type">char</span> *QMetaProperty::<span class="name">name</span>() const</h3> <p>Returns this property's name.</p> <p><b>See also </b><a href="qmetaproperty.html#type">type</a>() and <a href="qmetaproperty.html#typeName">typeName</a>().</p> <!-- @@@name --> <!-- $$$notifySignal[overload1]$$$notifySignal --> <h3 class="fn" id="notifySignal"><a name="notifySignal"></a><span class="type"><a href="qmetamethod.html">QMetaMethod</a></span> QMetaProperty::<span class="name">notifySignal</span>() const</h3> <p>Returns the <a href="qmetamethod.html">QMetaMethod</a> instance of the property change notifying signal if one was specified, otherwise returns an invalid <a href="qmetamethod.html">QMetaMethod</a>.</p> <p>This function was introduced in Qt 4.5.</p> <p><b>See also </b><a href="qmetaproperty.html#hasNotifySignal">hasNotifySignal</a>().</p> <!-- @@@notifySignal --> <!-- $$$notifySignalIndex[overload1]$$$notifySignalIndex --> <h3 class="fn" id="notifySignalIndex"><a name="notifySignalIndex"></a><span class="type">int</span> QMetaProperty::<span class="name">notifySignalIndex</span>() const</h3> <p>Returns the index of the property change notifying signal if one was specified, otherwise returns -1.</p> <p>This function was introduced in Qt 4.6.</p> <p><b>See also </b><a href="qmetaproperty.html#hasNotifySignal">hasNotifySignal</a>().</p> <!-- @@@notifySignalIndex --> <!-- $$$propertyIndex[overload1]$$$propertyIndex --> <h3 class="fn" id="propertyIndex"><a name="propertyIndex"></a><span class="type">int</span> QMetaProperty::<span class="name">propertyIndex</span>() const</h3> <p>Returns this property's index.</p> <p>This function was introduced in Qt 4.6.</p> <!-- @@@propertyIndex --> <!-- $$$read[overload1]$$$readconstQObject* --> <h3 class="fn" id="read"><a name="read"></a><span class="type"><a href="qvariant.html">QVariant</a></span> QMetaProperty::<span class="name">read</span>(const <span class="type"><a href="qobject.html">QObject</a></span> *<i>object</i>) const</h3> <p>Reads the property's value from the given <i>object</i>. Returns the value if it was able to read it; otherwise returns an invalid variant.</p> <p><b>See also </b><a href="qmetaproperty.html#write">write</a>(), <a href="qmetaproperty.html#reset">reset</a>(), and <a href="qmetaproperty.html#isReadable">isReadable</a>().</p> <!-- @@@read --> <!-- $$$readOnGadget[overload1]$$$readOnGadgetconstvoid* --> <h3 class="fn" id="readOnGadget"><a name="readOnGadget"></a><span class="type"><a href="qvariant.html">QVariant</a></span> QMetaProperty::<span class="name">readOnGadget</span>(const <span class="type">void</span> *<i>gadget</i>) const</h3> <p>Reads the property's value from the given <i>gadget</i>. Returns the value if it was able to read it; otherwise returns an invalid variant.</p> <p>This function should only be used if this is a property of a <a href="qobject.html#Q_GADGET">Q_GADGET</a></p> <p>This function was introduced in Qt 5.5.</p> <!-- @@@readOnGadget --> <!-- $$$reset[overload1]$$$resetQObject* --> <h3 class="fn" id="reset"><a name="reset"></a><span class="type">bool</span> QMetaProperty::<span class="name">reset</span>(<span class="type"><a href="qobject.html">QObject</a></span> *<i>object</i>) const</h3> <p>Resets the property for the given <i>object</i> with a reset method. Returns <code>true</code> if the reset worked; otherwise returns <code>false</code>.</p> <p>Reset methods are optional; only a few properties support them.</p> <p><b>See also </b><a href="qmetaproperty.html#read">read</a>() and <a href="qmetaproperty.html#write">write</a>().</p> <!-- @@@reset --> <!-- $$$resetOnGadget[overload1]$$$resetOnGadgetvoid* --> <h3 class="fn" id="resetOnGadget"><a name="resetOnGadget"></a><span class="type">bool</span> QMetaProperty::<span class="name">resetOnGadget</span>(<span class="type">void</span> *<i>gadget</i>) const</h3> <p>Resets the property for the given <i>gadget</i> with a reset method. Returns <code>true</code> if the reset worked; otherwise returns <code>false</code>.</p> <p>Reset methods are optional; only a few properties support them.</p> <p>This function should only be used if this is a property of a <a href="qobject.html#Q_GADGET">Q_GADGET</a></p> <p>This function was introduced in Qt 5.5.</p> <!-- @@@resetOnGadget --> <!-- $$$revision[overload1]$$$revision --> <h3 class="fn" id="revision"><a name="revision"></a><span class="type">int</span> QMetaProperty::<span class="name">revision</span>() const</h3> <p>Returns the property revision if one was specified by REVISION, otherwise returns 0.</p> <p>This function was introduced in Qt 5.1.</p> <!-- @@@revision --> <!-- $$$type[overload1]$$$type --> <h3 class="fn" id="type"><a name="type"></a><span class="type"><a href="qvariant-obsolete.html#Type-enum">QVariant::Type</a></span> QMetaProperty::<span class="name">type</span>() const</h3> <p>Returns this property's type. The return value is one of the values of the QVariant::Type enumeration.</p> <p><b>See also </b><a href="qmetaproperty.html#userType">userType</a>(), <a href="qmetaproperty.html#typeName">typeName</a>(), and <a href="qmetaproperty.html#name">name</a>().</p> <!-- @@@type --> <!-- $$$typeName[overload1]$$$typeName --> <h3 class="fn" id="typeName"><a name="typeName"></a>const <span class="type">char</span> *QMetaProperty::<span class="name">typeName</span>() const</h3> <p>Returns the name of this property's type.</p> <p><b>See also </b><a href="qmetaproperty.html#type">type</a>() and <a href="qmetaproperty.html#name">name</a>().</p> <!-- @@@typeName --> <!-- $$$userType[overload1]$$$userType --> <h3 class="fn" id="userType"><a name="userType"></a><span class="type">int</span> QMetaProperty::<span class="name">userType</span>() const</h3> <p>Returns this property's user type. The return value is one of the values that are registered with <a href="qmetatype.html">QMetaType</a>, or <a href="qmetatype.html#Type-enum">QMetaType::UnknownType</a> if the type is not registered.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also </b><a href="qmetaproperty.html#type">type</a>(), <a href="qmetatype.html">QMetaType</a>, and <a href="qmetaproperty.html#typeName">typeName</a>().</p> <!-- @@@userType --> <!-- $$$write[overload1]$$$writeQObject*constQVariant& --> <h3 class="fn" id="write"><a name="write"></a><span class="type">bool</span> QMetaProperty::<span class="name">write</span>(<span class="type"><a href="qobject.html">QObject</a></span> *<i>object</i>, const <span class="type"><a href="qvariant.html">QVariant</a></span> &<i>value</i>) const</h3> <p>Writes <i>value</i> as the property's value to the given <i>object</i>. Returns true if the write succeeded; otherwise returns <code>false</code>.</p> <p>If <i>value</i> is not of the same type type as the property, a conversion is attempted. An empty QVariant() is equivalent to a call to <a href="qmetaproperty.html#reset">reset</a>() if this property is resetable, or setting a default-constructed object otherwise.</p> <p><b>See also </b><a href="qmetaproperty.html#read">read</a>(), <a href="qmetaproperty.html#reset">reset</a>(), and <a href="qmetaproperty.html#isWritable">isWritable</a>().</p> <!-- @@@write --> <!-- $$$writeOnGadget[overload1]$$$writeOnGadgetvoid*constQVariant& --> <h3 class="fn" id="writeOnGadget"><a name="writeOnGadget"></a><span class="type">bool</span> QMetaProperty::<span class="name">writeOnGadget</span>(<span class="type">void</span> *<i>gadget</i>, const <span class="type"><a href="qvariant.html">QVariant</a></span> &<i>value</i>) const</h3> <p>Writes <i>value</i> as the property's value to the given <i>gadget</i>. Returns true if the write succeeded; otherwise returns <code>false</code>.</p> <p>This function should only be used if this is a property of a <a href="qobject.html#Q_GADGET">Q_GADGET</a></p> <p>This function was introduced in Qt 5.5.</p> <!-- @@@writeOnGadget --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 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>