1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/corelib/kernel/qmetaobject.cpp -->
7
<title>Qt 4.0: QMetaProperty Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QMetaProperty Class Reference</h1>
21
<p>The QMetaProperty class provides meta-data about a property. <a href="#details">More...</a></p>
22
<pre>#include <QMetaProperty></pre><p>Part of the <a href="qtcore.html">QtCore</a> module.</p>
24
<li><a href="qmetaproperty-members.html">List of all members, including inherited members</a></li>
26
<a name="public-functions"></a>
27
<h3>Public Functions</h3>
29
<li><div class="fn"/>QMetaEnum <b><a href="qmetaproperty.html#enumerator">enumerator</a></b> () const</li>
30
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#isDesignable">isDesignable</a></b> ( const QObject * <i>object</i> = 0 ) const</li>
31
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#isEditable">isEditable</a></b> ( const QObject * <i>object</i> = 0 ) const</li>
32
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#isEnumType">isEnumType</a></b> () const</li>
33
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#isFlagType">isFlagType</a></b> () const</li>
34
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#isReadable">isReadable</a></b> () const</li>
35
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#isScriptable">isScriptable</a></b> ( const QObject * <i>object</i> = 0 ) const</li>
36
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#isStored">isStored</a></b> ( const QObject * <i>object</i> = 0 ) const</li>
37
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#isValid">isValid</a></b> () const</li>
38
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#isWritable">isWritable</a></b> () const</li>
39
<li><div class="fn"/>const char * <b><a href="qmetaproperty.html#name">name</a></b> () const</li>
40
<li><div class="fn"/>QVariant <b><a href="qmetaproperty.html#read">read</a></b> ( const QObject * <i>object</i> ) const</li>
41
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#reset">reset</a></b> ( QObject * <i>object</i> ) const</li>
42
<li><div class="fn"/>QVariant::Type <b><a href="qmetaproperty.html#type">type</a></b> () const</li>
43
<li><div class="fn"/>const char * <b><a href="qmetaproperty.html#typeName">typeName</a></b> () const</li>
44
<li><div class="fn"/>bool <b><a href="qmetaproperty.html#write">write</a></b> ( QObject * <i>object</i>, const QVariant & <i>value</i> ) const</li>
46
<a name="details"></a>
48
<h2>Detailed Description</h2>
49
<p>The QMetaProperty class provides meta-data about a property.</p>
50
<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#isStored">isStored</a>(), and <a href="qmetaproperty.html#isEditable">isEditable</a>().</p>
51
<p>If the property is an enumeration, <a href="qmetaproperty.html#isEnumType">isEnumType</a>() returns true; 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>
52
<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>
53
<p>You get property meta-data through 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>
54
<p>See also <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>
56
<h2>Member Function Documentation</h2>
57
<h3 class="fn"><a name="enumerator"></a><a href="qmetaenum.html">QMetaEnum</a> QMetaProperty::enumerator () const</h3>
58
<p>Returns the enumerator if this property's type is an enumerator type; otherwise the returned value is undefined.</p>
59
<p>See also <a href="qmetaproperty.html#isEnumType">isEnumType</a>() and <a href="qmetaproperty.html#isFlagType">isFlagType</a>().</p>
60
<h3 class="fn"><a name="isDesignable"></a>bool QMetaProperty::isDesignable ( const <a href="qobject.html">QObject</a> * <i>object</i> = 0 ) const</h3>
61
<p>Returns true if this property is designable for the given <i>object</i>; otherwise returns false.</p>
62
<p>If no <i>object</i> is given, the function returns false if the <tt>Q_PROPERTY()</tt>'s <tt>DESIGNABLE</tt> attribute is false; otherwise returns true (if the attribute is true or is a function or expression).</p>
63
<p>See also <a href="qmetaproperty.html#isScriptable">isScriptable</a>(), <a href="qmetaproperty.html#isStored">isStored</a>(), and <a href="qmetaproperty.html#isEditable">isEditable</a>().</p>
64
<h3 class="fn"><a name="isEditable"></a>bool QMetaProperty::isEditable ( const <a href="qobject.html">QObject</a> * <i>object</i> = 0 ) const</h3>
65
<p>Returns true if the property is editable for the given <i>object</i>; otherwise returns false.</p>
66
<p>If no <i>object</i> is given, the function returns false if the <tt>Q_PROPERTY()</tt>'s <tt>DESIGNABLE</tt> attribute is false; otherwise returns true (if the attribute is true or is a function or expression).</p>
67
<p>See also <a href="qmetaproperty.html#isDesignable">isDesignable</a>(), <a href="qmetaproperty.html#isScriptable">isScriptable</a>(), and <a href="qmetaproperty.html#isStored">isStored</a>().</p>
68
<h3 class="fn"><a name="isEnumType"></a>bool QMetaProperty::isEnumType () const</h3>
69
<p>Returns true if the property's type is an enumeration value; otherwise returns false.</p>
70
<p>See also <a href="qmetaproperty.html#enumerator">enumerator</a>() and <a href="qmetaproperty.html#isFlagType">isFlagType</a>().</p>
71
<h3 class="fn"><a name="isFlagType"></a>bool QMetaProperty::isFlagType () const</h3>
72
<p>Returns true if the property's type is an enumeration value that is used as a flag; otherwise returns false.</p>
73
<p>Flags can be combined using the OR operator. A flag type is implicitly also an enum type.</p>
74
<p>See also <a href="qmetaproperty.html#isEnumType">isEnumType</a>(), <a href="qmetaproperty.html#enumerator">enumerator</a>(), and <a href="qmetaenum.html#isFlag">QMetaEnum::isFlag</a>().</p>
75
<h3 class="fn"><a name="isReadable"></a>bool QMetaProperty::isReadable () const</h3>
76
<p>Returns true if this property is readable; otherwise returns false.</p>
77
<p>See also <a href="qmetaproperty.html#isWritable">isWritable</a>(), <a href="qmetaproperty.html#read">read</a>(), and <a href="qmetaproperty.html#isValid">isValid</a>().</p>
78
<h3 class="fn"><a name="isScriptable"></a>bool QMetaProperty::isScriptable ( const <a href="qobject.html">QObject</a> * <i>object</i> = 0 ) const</h3>
79
<p>Returns true if the property is scriptable for the given <i>object</i>; otherwise returns false.</p>
80
<p>If no <i>object</i> is given, the function returns false if the <tt>Q_PROPERTY()</tt>'s <tt>DESIGNABLE</tt> attribute is false; otherwise returns true (if the attribute is true or is a function or expression).</p>
81
<p>See also <a href="qmetaproperty.html#isDesignable">isDesignable</a>(), <a href="qmetaproperty.html#isStored">isStored</a>(), and <a href="qmetaproperty.html#isEditable">isEditable</a>().</p>
82
<h3 class="fn"><a name="isStored"></a>bool QMetaProperty::isStored ( const <a href="qobject.html">QObject</a> * <i>object</i> = 0 ) const</h3>
83
<p>Returns true if the property is stored for <i>object</i>; otherwise returns false.</p>
84
<p>If no <i>object</i> is given, the function returns false if the <tt>Q_PROPERTY()</tt>'s <tt>DESIGNABLE</tt> attribute is false; otherwise returns true (if the attribute is true or is a function or expression).</p>
85
<p>See also <a href="qmetaproperty.html#isDesignable">isDesignable</a>(), <a href="qmetaproperty.html#isScriptable">isScriptable</a>(), and <a href="qmetaproperty.html#isEditable">isEditable</a>().</p>
86
<h3 class="fn"><a name="isValid"></a>bool QMetaProperty::isValid () const</h3>
87
<p>Returns true if this property is valid (readable); otherwise returns false.</p>
88
<p>See also <a href="qmetaproperty.html#isReadable">isReadable</a>().</p>
89
<h3 class="fn"><a name="isWritable"></a>bool QMetaProperty::isWritable () const</h3>
90
<p>Returns true if this property is writable; otherwise returns false.</p>
91
<p>See also <a href="qmetaproperty.html#isReadable">isReadable</a>() and <a href="qmetaproperty.html#write">write</a>().</p>
92
<h3 class="fn"><a name="name"></a>const char * QMetaProperty::name () const</h3>
93
<p>Returns this property's name.</p>
94
<p>See also <a href="qmetaproperty.html#type">type</a>() and <a href="qmetaproperty.html#typeName">typeName</a>().</p>
95
<h3 class="fn"><a name="read"></a><a href="qvariant.html">QVariant</a> QMetaProperty::read ( const <a href="qobject.html">QObject</a> * <i>object</i> ) const</h3>
96
<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>
97
<p>See also <a href="qmetaproperty.html#write">write</a>(), <a href="qmetaproperty.html#reset">reset</a>(), and <a href="qmetaproperty.html#isReadable">isReadable</a>().</p>
98
<h3 class="fn"><a name="reset"></a>bool QMetaProperty::reset ( <a href="qobject.html">QObject</a> * <i>object</i> ) const</h3>
99
<p>Resets the property for the given <i>object</i> with a reset method. Returns true if the reset worked; otherwise returns false.</p>
100
<p>Reset methods are optional; only a few properties support them.</p>
101
<p>See also <a href="qmetaproperty.html#read">read</a>() and <a href="qmetaproperty.html#write">write</a>().</p>
102
<h3 class="fn"><a name="type"></a><a href="qvariant.html#Type-enum">QVariant::Type</a> QMetaProperty::type () const</h3>
103
<p>Returns this property's type. The return value is one of the values of the <a href="qvariant.html#Type-enum">QVariant::Type</a> enumeration.</p>
104
<p>See also <a href="qmetaproperty.html#typeName">typeName</a>() and <a href="qmetaproperty.html#name">name</a>().</p>
105
<h3 class="fn"><a name="typeName"></a>const char * QMetaProperty::typeName () const</h3>
106
<p>Returns the name of this property's type.</p>
107
<p>See also <a href="qmetaproperty.html#type">type</a>() and <a href="qmetaproperty.html#name">name</a>().</p>
108
<h3 class="fn"><a name="write"></a>bool QMetaProperty::write ( <a href="qobject.html">QObject</a> * <i>object</i>, const <a href="qvariant.html">QVariant</a> & <i>value</i> ) const</h3>
109
<p>Writes <i>value</i> as the property's value to the given <i>object</i>. Returns true if the write succeeded; otherwise returns false.</p>
110
<p>See also <a href="qmetaproperty.html#read">read</a>(), <a href="qmetaproperty.html#reset">reset</a>(), and <a href="qmetaproperty.html#isWritable">isWritable</a>().</p>
111
<p /><address><hr /><div align="center">
112
<table width="100%" cellspacing="0" border="0"><tr class="address">
113
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
114
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
115
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
116
</tr></table></div></address></body>